Hi all
I want to find random numbers from an given array for that i use following logic but i am not getting expected answer yet
protected void Page_Load(object sender, EventArgs e)
{
int[] numarr = { 14, 22, 44, 33, 55, 82, 91, 16, 17, 15 };
int[] a = new int[10];
int[] b = new int[10];
int no = 0;
int count = numarr .Length;
Random RandomNumber = new Random();
for (int i = 0; i < count; i++)
{
no = RandomNumber.Next(1, count);
if (!b.Contains(no))
{
b[i] = no;
a[no] = numarr [i];
}
}
foreach (int j in a)
{
Response.Write("First Number:" + j + "</br>");
}
}
In this code the problem is RandomNumber.Next gives duplicate numbers
I just wants to change the sequence of numbers in numarr array
Please help...