Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8532

About Random in for loop

$
0
0

@daizhuo wrote:

List<int> intnum = new List<int>();

    for(int i = 0;i < 10;i++)
    {
      Random rnd = new Random();
      int num = rnd.Next(0, 2);
      if(num == 0)
      {
        intnum.Add(num);
      }
    }
    A = intnum;

In upon code, I can't get random numbers, why?
I get all the same numbers!

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8532

Trending Articles