How do I do Randomize in C#?
Printable View
How do I do Randomize in C#?
you would use System.Random class, you can seed the value to make it more random by using the overloaded constructor Random(int) :) like the current time in seconds for instance. and to return a random value once u have an instance of the class use the Next method ex:
Random rand = new Random();
rand.Next();
or
rand.Next(maxvalue);
or
rand.Next(minvalue, maxvalue);
example,
you can instantiate Random class by
Random RA = new Random();
or
Random RA = new Random(15);
and further use to get the new seed
int num = ra.Next();
Paresh