Generating Random Numbers

From TRCCompSci - AQA Computer Science
Jump to: navigation, search

Code

Random Rnd = new Random(); //This is the number generator

Rnd.Next(); // gets you a random number between 0 & 1
Rnd.Next(10); // you can set an upper value (this will be 0 to 9)
Rnd.Next(1, 11); // you can set a lower and upper value (this will give 1 to 10)