Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!psuvax1!news From: melling@cs.psu.edu (Michael D Mellinger) Newsgroups: comp.os.msdos.programmer Subject: Re: Random Numbers Message-ID: Date: 4 Mar 91 05:24:13 GMT References: <1991Mar2.201214.22848@herald.usask.ca> Sender: news@cs.psu.edu (Usenet) Distribution: comp Organization: Penn State Computer Science Lines: 24 In-Reply-To: reeves@dvinci's message of Sat, 2 Mar 91 20:12:14 GMT Nntp-Posting-Host: sunws5.sys.cs.psu.edu In article <1991Mar2.201214.22848@herald.usask.ca> reeves@dvinci (Malcolm Reeves) writes: (1) Must the generator be able to produce an identical sequence on request? (2) Must the code be portable from machine to machine and give the same results? (3) What tests of randomness must the numbers pass? (4) What distribution do you want the numbers to have? I just need a random number between 1 and 100 so I can index an array that holds the result. For example, if the number is random then I should have a 40% chance of picking the number 20 if I pick a random number b/w 1 and 5. index 1 2 3 4 5 value 1 20 20 34 1 In other words, I know the exact distribution. Seeding srand() with the value of the clock should work. Does anyone see any problems with this? Another question...next message. -Mike