i want to generate a set of random numbers and store that in an array, and when i was trying to do the same thing using a for loop i am getting a series of numbers like 1,1,1,1,.. or 6,6,6,6.. the same number is getting repeated. don't know why.
i am having a string in n1 i.e.., string n1="helloadithyahowareyou"
and the variable randomNumber contains a value in between (0,n1.lenght) and for that i have written a separate code.. and that is working fine.
code:
for (int i = 0; i <randomNumber; i++)
{
Random rand = new Random();
int randnum = rand.Next(0, n1.Length);
arr1[i] = randnum;
}