Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!dog.ee.lbl.gov!ucsd!hub.ucsb.edu!ucsbuxa!6600m00n From: 6600m00n@ucsbuxa.ucsb.edu (Steelworker) Newsgroups: comp.os.msdos.programmer Subject: Re: Random Numbers Message-ID: <9581@hub.ucsb.edu> Date: 2 Mar 91 06:21:17 GMT References: Sender: news@hub.ucsb.edu Distribution: comp Lines: 13 >How can I get a random number on on DOS machines? Seeding the random ># generator with the system clock seemed like a good idea, but not all >machines have clocks. Here is what I am doing now. >srand( (unsigned int) time(theTime)) >Then I successively call rand() to get my random #. >Anyone have a better idea? >-Mike One technique is to use as a seed the time it takes for a user to hit a key at a prompt, in sufficently small time units. Or run a keyboard polling routine, and use the loop variable. Rob.