Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!swrinde!ucsd!nosc!dog.ee.lbl.gov!ux5.lbl.gov!beard From: beard@ux5.lbl.gov (Patrick C Beard) Newsgroups: comp.sys.mac.programmer Subject: Re: Random() from with AfterDark (was Re: System Error 389) Message-ID: <10063@dog.ee.lbl.gov> Date: 19 Feb 91 23:31:00 GMT References: <1991Feb18.221718.9087@portia.Stanford.EDU> <91050.080755CXT105@psuvm.psu.edu> Reply-To: beard@ux5 (Patrick C Beard) Organization: Berkeley Systems, Inc. Lines: 26 X-Local-Date: Tue, 19 Feb 91 15:31:00 PST In article <91050.080755CXT105@psuvm.psu.edu> CXT105@psuvm.psu.edu (Christopher Tate) writes: #In article <1991Feb18.221718.9087@portia.Stanford.EDU>, #ralphm@portia.Stanford.EDU (Ralph Melton) inquires: # #>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? # #You might want to put in your own random number seed, and then replace #the original contents of randSeed after calling Random(). If you just #trash the randSeed, it's certainly conceivable that you will interfere #with someone who's running statistical simulations of some sort, and #is relying on having a predictable sequence of numbers generated by #Random(). If my memory serves me, After Dark does that for you. It IS safe to call Random() from After Dark modules (we have many that do). -- ------------------------------------------------------------------ | Patrick C. Beard, Software Engineer, Berkeley Systems, Inc. | | "Heroes of technology." | | beard@lbl.gov, d0346@applelink.apple.com (ATTN: Patrick) |