Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!uupsi!cmcl2!lanl!p3.lanl.gov!egw.weakm From: egw.weakm@p3.lanl.gov (Eric Wasserman) Newsgroups: comp.sys.mac.programmer Subject: Re: Random() from with AfterDark (was Re: System Error 389) Message-ID: <15152@lanl.gov> Date: 20 Feb 91 02:03:41 GMT Sender: news@lanl.gov Organization: LANL Lines: 20 References:<1991Feb18.221718.9087@portia.Stanford.EDU> <91050.080755CXT105@psuvm.psu.edu> <10063@dog.ee.lbl.gov> In article <10063@dog.ee.lbl.gov> beard@ux5.lbl.gov (Patrick C Beard) writes: One last question: Is it inappropriate for me to call Random from within > an After Dark module? I realize that, since I don't have globals, if I > call Random, I am stepping on the RandSeed global of someone else's > A5 world. But RandSeed is supposed to contain a pseudorandom number. > If I replace it with a different pseudorandom number, will I give any > program problems? Why don't you just use your own random number routine? A standard linear- congruential generator is essentially one line of code and is every bit as good as the built-in Random(). At the same time, it is completely portable and won't screw up the global RandSeed. See the UMPG chapt. 1, or Knuth's "Seminumerical Algorithms", for examples. Eric Eric egw.weakm@p3.lanl.gov