🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #26416

Re: How Doy you get a real random number in LSC?

#26416
From: Jeff A. Hallett
Date: Wed, 16 Mar 1988 17:35
19 lines
1668 bytes
In article <7671@cisunx.UUCP> jasst3@cisunx.UUCP (Jeffrey A. Sullivan) writes:
>How do you get a real random number in LSC?  I have tried using rand() and
>Random() (from math lib and quickdraw, repectively).  They both give the same
>sequence of numbers each time at startup.  I am trying to write a randomizer
>INIT that works on a mac II, but the randomness is all that's holding me
>back.  (I think...)

Well, rand() works pretty well if you remember to change the seed each
time.  The best way I've seen to do this is by using the value off the
System clock.  You have to take it modulo the max seed size and then
set the seed to this value.  This will keep you from getting the same
"random" sequence every time.

Jeffrey A. Hallett                     | ARPA: hallett@ge-crd.arpa   
Software Technology Program    	       | UUCP: desdemona!hallett@steinmetz.uucp
GE Corporate Research and Development  | (518) 387-5654
+--------------------------------------+--------------------------------------+
|                            Credo Quia Absurdum Est                          |
+-----------------------------------------------------------------------------+
Technical Details
Message-ID: <9965@steinmetz.steinmetz.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!steinmetz!lear!hallett
References: <7671@cisunx.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!steinmetz!lear!hallett
From: hallett@lear.steinmetz (Jeff A. Hallett)
Newsgroups: comp.sys.mac
Subject: Re: How Doy you get a real random number in LSC?
Message-ID: <9965@steinmetz.steinmetz.UUCP>
Date: 16 Mar 88 17:35:50 GMT
References: <7671@cisunx.UUCP>
Sender: news@steinmetz.steinmetz.UUCP
Reply-To: desdemona!hallett@steinmetz.UUCP (Jeffrey A. Hallett)
Organization: General Electric CRD, Schenectady, NY
Lines: 19
Keywords: LSC C RANDOM