Random number in a loop

Posted by Sam on Stack Overflow See other posts from Stack Overflow or by Sam
Published on 2010-06-16T13:47:49Z Indexed on 2010/06/16 13:52 UTC
Read the original article Hit count: 165

Filed under:
|

Hi all, having an issue generating random numbers in a loop. Can get around it by using Thread.Sleep but after a more elegant solution.

for ...
    Random r = new Random();
    string += r.Next(4);

Will end up with 11111... 222... etc.

Suggestions?

© Stack Overflow or respective owner

Related posts about c#

Related posts about random