Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!endor!waldman From: waldman@endor.harvard.edu (benjamin Waldman) Newsgroups: comp.sys.mac.programmer Subject: Re: Calling Random Summary: You have to initialize QuickDraw first Message-ID: <1673@husc6.harvard.edu> Date: 22 Apr 89 15:53:58 GMT References: <1055@mailrus.cc.umich.edu> Sender: news@husc6.harvard.edu Reply-To: waldman@endor.UUCP (benjamin Waldman) Distribution: comp.sys.mac.programmer Organization: Aiken Computation Lab Harvard, Cambridge, MA Lines: 19 In article <1055@mailrus.cc.umich.edu> davidh@ronin.cc.umich.edu (David Hotchkiss) writes: > >I'm trying to write some simple simulation programs that involve making >calls to the random number generator. Whenever I try calling the Random >funtion, I get a Bus error. However, the stackpointer is still even. > >I've followed the suggestions in IM to call GetDateTime and set randseed >equal to it but I still have the same problem. Have you initilized QuickDraw yet? Random() uses the value of randSeed to determine the next random number, and randSeed is a QuickDraw global, not a system global. Thus, if QuickDraw hasn't been initialized, and A5 or 0(a5) (I forget which) is pointing to and odd address (on a 68000 machine) or a huge address (68020), you'll bomb. Ben Waldman Harvard College waldman@endor.harvard.edu