- May 4, 2001
- 15,381
- 6
- 91
Hi,
I need to generate a random number between 0 and 1 using c++.
i figured it would simply be rand()%1 (seeded with the system clock ) from the stdlib.h, but that always gives me back 0.
Does rand() give back a double? ('cause I know RAND_MAX is huge).
All I need is any decimal between 0 and 1.
Any help is appreciated.
Thx
I need to generate a random number between 0 and 1 using c++.
i figured it would simply be rand()%1 (seeded with the system clock ) from the stdlib.h, but that always gives me back 0.
Does rand() give back a double? ('cause I know RAND_MAX is huge).
All I need is any decimal between 0 and 1.
Any help is appreciated.
Thx