Hi,
I've seen various methods for generating a random number within a range around the internet and in books, but some are very roundabout and I'm wondering if someone could provide me with the simplest method for generating a random number in a certain range. My program will have to do this many times, and so I would like as much succinctness as possible.
An instance of what would need to be calculated:
/* I would like floating point random numbers with three decimal places.
The range should be set by another place in the program, and so I need variables as the values of RangeMin & RangeMax */
float RangeMin;
float RangeMax;
Rand_Num1 = rand(....in the range of Min to Max...)
etc
Thanks.



LinkBack URL
About LinkBacks



