🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4969

Re: Random Numbers

#4969
From: Steelworker
Date: Sat, 02 Mar 1991 06:21
13 lines
928 bytes
>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.
Technical Details
Message-ID: <9581@hub.ucsb.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!dog.ee.lbl.gov!ucsd!hub.ucsb.edu!ucsbuxa!6600m00n
References: <r7bGl?wz@cs.psu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <r7bGl?wz@cs.psu.edu>
Sender: news@hub.ucsb.edu
Distribution: comp
Lines: 13