Random class in .Net is part of System namespace
//Declare an object
Random randomNumberGenerator = new Random();
random.NextDouble() //to get the next random number between 0.0 and 1.0;
random.Next() // to get the next random positive integer number
// to get the next random integer, x where 'upper' <= x < 'lower'
random.Next(lower, upper)
Byte[] b = new Byte[10];
random.NextBytes(b); to set an array of bytes
//To set a seed for the random number generator
int seed = 137;
System.Random randomNumberGenerator = new System.Random(seed);
No comments:
Post a Comment