home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!pageworks.com!world!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!alexia!cole
- From: cole@alexia.lis.uiuc.edu (Sandra Stewart-Cole)
- Subject: Re: looking for a REALLY RaNdOM "RANDOM"
- References: <1djhjiINNhlc@mthvax.cs.miami.edu>
- Message-ID: <BxMI8x.MG9@news.cso.uiuc.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: University of Illinois at Urbana
- Date: Thu, 12 Nov 1992 21:55:44 GMT
- Keywords: random
- Lines: 24
-
- In <1djhjiINNhlc@mthvax.cs.miami.edu> rsherman@mthvax.cs.miami.edu (Roby
- Sherman) writes:
-
- >Hello all.
-
- >I'm looking for a pascal piece of code that illustrates a really nice
- >random number generation.
-
- >I'm working on an INIT that needs a few random numbers and at boot time,
- >Apple's RANDOM function seems to always retrurn the same old thing.
- >Any ideas?
-
-
- interesting thing to note... I suppose it is because the seed for it is
- connected to how long the machine has been on? (i.e. in the same Mac, an INIT
- will see the same thing every time)
-
- If you want a way of generating different random numbers, the principle isn't
- too tough. one quick psuedo-random number would just be some modulo math on the
- current date/time value. (for example, date mod 99 will give you a random
- number between 0 and 98) Depending on how random you want the number, you can
- get into some very fancy number twiddling to make things more erratic, but in
- all likelihood, some modulo of the date/time (which is seconds since 12 am
- 1/1/04) with an odd value should give you a useable base.
-