how to get a random number between 0 and 1
C / C++ / MFC
4
Posts
4
Posters
0
Views
1
Watching
-
I want a fucntion to generate a random number between 0 and 1, and each time this function is executed, it will give me a diffent value (independent to time).Can you help me?Thanks a lot.
-
I want a fucntion to generate a random number between 0 and 1, and each time this function is executed, it will give me a diffent value (independent to time).Can you help me?Thanks a lot.
The best you can hope for is a pseudo-random number. Use
rand()
for this?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
rand()/RAND_MAX.
Not exactly working. Integer arithmetic here. :) -- modified at 14:13 Monday 10th October, 2005