Hi,
Can you tell me how to make the numbers more random, it uses the same numbers in so many fields, i need them to be as different as possible essentially.
If you run this code you will see what i mean.
dataGridView2.ColumnCount = 4;
dataGridView2.Columns[0].Name = "Column1";
dataGridView2.Columns[1].Name = "Column2";
dataGridView2.Columns[2].Name = "Column3";
dataGridView2.Columns[3].Name = "Column4";
for (int i = 0; i < 100; i++)
{
Random t = new Random();
int get = t.Next(1, 1000);
int set = t.Next(1, 1000);
int ready = t.Next(1, 1000);
int go = t.Next(1, 1000);
dataGridView2.Rows.Add(get, set, ready, go);
Thanks
Anthony
Loading

Sam HobbsRank #107 · 20.5K reputationPosted Dec 12, 2010, 8:10 AM EST
Sam HobbsRank #107 · 20.5K reputationPosted Dec 11, 2010, 7:02 PM EST
Subhendu DeRank #1,108 · 1.7K reputationPosted Dec 11, 2010, 7:34 PM EST
http://www.c-sharpcorner.com/UploadFile/rmcochran/random07172006175425PM/random.aspx
Thanks.....
Anthony Clarke99 reputationPosted Dec 12, 2010, 6:09 AM EST
No its not the same, its pretty much the same code but i couldnt even populate random before, but now it just doesnt seem that random there are chunks of 20 all with the same data so im trying to find a method that ill give me almost unique values and not 20 of this number 20 of another etc.
Thanks
Anthony
Mahesh ChandRank #1 · 393.3K reputationPosted Dec 12, 2010, 6:23 AM EST
Please do not post same questions on multiple forum categories.
Thanks!
Subhendu DeRank #1,108 · 1.7K reputationPosted Dec 12, 2010, 11:44 PM EST
Anthony,
This is the code. Try it out and request you to accept his post as answer.
dataGridView1.ColumnCount = 4;
dataGridView1.Columns[0].Name = "Column1";
dataGridView1.Columns[1].Name = "Column2";
dataGridView1.Columns[2].Name = "Column3";
dataGridView1.Columns[3].Name = "Column4";
Random t = new Random();
for (int i = 0; i < 100; i++)
{
int get = t.Next(1, 1000);
int set = t.Next(1, 1000);
int ready = t.Next(1, 1000);
int go = t.Next(1, 1000);
dataGridView1.Rows.Add(get, set, ready, go);
}
Thanks.....
Anthony Clarke99 reputationPosted Dec 13, 2010, 12:41 AM EST
Thanks to both of you :-)