The correct way to do that is to create an instance of the
Random class and then call one of the following methods:
-
Next(Int32 max) // will return a random number smaller than max
-
NextByte() // will return a random byte (between 0 and 255)
-
NextDouble() // will return a random number between 0.0 and 1.0<br />
Here's a code sample which will generate two random numbers, a and b, between 0 and 10
<br />Random rnd = new Random();<br />int a = rnd.Next(10);<br />int b = rng.Next(10);<br />