How do I go about producing random numbers within a range?
+1
A:
Something like:
var rnd = new Random(DateTime.Now.Millisecond);
int ticks = rnd.Next(0, 3000);
ozczecho
2010-10-20 06:37:19
+3
A:
You can try
Random r = new Random();
int rInt = r.Next(0, 100); //for ints
int range = 100;
double rDouble = r.NextDouble()* range; //for doubles
Have a look at
Random Class, Random.Next Method (Int32, Int32) and Random.NextDouble Method
astander
2010-10-20 06:37:46
A:
Aside of the Random Class, which generates integers and doubles, consider:
ohadsc
2010-10-20 08:21:57