Date: Tue, 26 Aug 1997 11:30:49 -0700 (PDT) Message-Id: <199708261830.LAA11115@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: ah897 AT detroit DOT freenet DOT org (Heathen), djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: Random numbers... Cc: xyy AT infonie DOT be Precedence: bulk At 11:52 8/20/1997 GMT, Heathen wrote: >In article <01bcaa71$4c08c200$0d5e4ec2 AT xyy>, xyy AT infonie DOT be says... >>I still can't obtain truly random numbers with the srand(), random(), and >>rand() functions, because, whatever the seed number i put in srand(), it is >>_always the same results. >> >>What can i do about it ? >Hey here's a neat trick I used with Borland's C++ 3.0 from awhile ago for Random >Number Generater: > #include > Main(){ > int Jims_Rand_Num; > gettime(&ti_hund); > Jims_Rand_Num = ti_hund; > > } > The very best method is to seed the random number generator from the current time. In DJGPP, that looks like this: #include #include /* ... */ srand(time(NULL)); /* Now use rand() to get random numbers. */ HTH Nate Eldredge eldredge AT ap DOT net