Newsgroups: comp.os.msdos.djgpp Subject: Re: Newbie Question: Random Numbers Message-ID: <33dd9bad.1471111@news.nl.net> From: hbezemer AT vsngroep DOT nl (Hans Bezemer) Date: Tue, 29 Jul 1997 07:31:51 GMT Reply-To: hbezemer AT vsngroep DOT nl References: <01bc9a61$57701640$204678c7 AT warren1> <5rfinq$fan$1 AT nargun DOT cc DOT uq DOT edu DOT au> Organization: VSN groep NNTP-Posting-Host: utr97-29.utrecht.nl.net Lines: 18 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Sun, 27 Jul 1997 23:34:04 +1000, "Trent and Zacc" wrote: >Are you seeding the randomiser? This starts you at a different point in >the sequence which makes it more difficult to tell that the numbers >are not really entirely random. > >If you aren't try using: srand( time( NULL) ) > >This will give a fairly good random sequence of numbers. Correct! I used this technique when developing my 4tH compiler, simply because I didn't want to put the burden of seeding the randomizer to the user. I have written a procedure that generates 1,000,000 numbers between 0 and 9 and it comes up different all the time. Any problem is highly academical, IMHO. Hans