Random randNum = new Random();
randNum.Next();
That's all it takes. The creation of a Random object (of the System.Random class) and calling its Next() method, which is going to return a non-negative random number as an integer.
EX:
Random randNum = new Random();
randNum.Next(108); // No larger than 108
No comments:
Post a Comment