[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re:
Hi,
Deepak Yadav typed:
> my program to generate random numbers give same set every time i run it. plz
> help (i am using linux 6.2 and its random dameon is ON)
> srand(1);
If you give a constant seed, you'll get the same numbers every time.
Use srand(time(NULL)) instead, or something of that sort.
--
Mrinal Kalakrishnan <mrinal@xxxxxxxxx> http://mrinal.dhs.org/
Linux 2.2.16 || PGP:B1E86F5B || Mutt 1.3.3i (2000-06-09) || VIM 5.6
--
"Whip me. Beat me. Make me maintain AIX."
(By Stephan Zielinski)