Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!csn!boulder!tigger!savage From: savage@tigger.Colorado.EDU (Metallica Rules) Newsgroups: comp.unix.programmer Subject: Re: Trying to generate random random numbers! Message-ID: <1991Mar30.213226.5657@colorado.edu> Date: 30 Mar 91 21:32:26 GMT References: <7161@bgsuvax.UUCP> <1991Mar18.054012.24970@athena.mit.edu> Sender: news@colorado.edu (The Daily Planet) Organization: University of Colorado, Boulder Lines: 19 Nntp-Posting-Host: tigger.colorado.edu In article <1991Mar18.054012.24970@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: >In article <7161@bgsuvax.UUCP>, sapienza@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@boulder.colorado.edu