|
-
March 16th, 2003, 02:06 PM
#1
Randomize
How do I do Randomize in C#?
-
March 16th, 2003, 05:07 PM
#2
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);
-
March 17th, 2003, 05:35 PM
#3
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
- Software Architect
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|