Trying to generate random random numbers!

Metallica Rules savage at tigger.Colorado.EDU
Sun Mar 31 07:32:26 AEST 1991


In article <1991Mar18.054012.24970 at athena.mit.edu> jik at athena.mit.edu (Jonathan I. Kamens) writes:
>In article <7161 at bgsuvax.UUCP>, sapienza at bgsuvax.UUCP (Michael A. Sapienza) writes:
>|> I could use some help in generating random numbers.  The problem I am having
>|> is that I get the same set of numbers each time that I run the program.  I
>|> have tried using srandom (seed) and entering the seed from the keyboard,
>|> but this also returns the same random number.  Any help would be greatly
>|> appreciated!
>

I have encountered the problem before, and my soulution to it has been to
seed the generator with a diriviative of the seconds in the clock/time.
Because each of the seconds in the time keep increasing from I think 1 Jan 1970.
So each seed will be different then the others, and you will always or should
get a different rand each time you run it.

Hope this helps...
Chuck
-- 
savage%tigger at boulder.colorado.edu



More information about the Comp.unix.programmer mailing list