Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!apple!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.sys.mac.programmer Subject: Re: Random help, please Message-ID: <549@internal.Apple.COM> Date: 6 Feb 89 22:53:47 GMT References: <69823DN5@PSUVM> <2671@munnari.oz> Organization: Advanced Technology Group, Apple Computer Lines: 29 In article <2671@munnari.oz> jkjl@munnari.UUCP (John Lim) writes: >In article <69823DN5@PSUVM> DN5@PSUVM.BITNET writes: >> I am working on a DA which needs some random numbers. My problem is that >>I always get the same sequence. I have tried setting randSeed, but this > > You just cannot simply reset randSeed in C by : > > randSeed = TickCount(); > > because LSC thinks that randSeed is a DA global offset by A4 and > not A5 (which is what u want). randSeed happens to be a Quickdraw global variable. A5 always points to a pointer to the Quickdraw variables. I think assembly code such as: MOVE.L (A5),A0 MOVE.L randSeed(A0),D0 will get randSeed. From the MPW assembler interfaces, it looks like randSeed is -$7E. Looking at the code for _Random in Macsbug seems to confirm this. -- Larry Rosenstein, Object Specialist Apple Computer, Inc. 20525 Mariani Ave, MS 46-B Cupertino, CA 95014 AppleLink:Rosenstein1 domain:lsr@Apple.COM UUCP:{sun,voder,nsc,decwrl}!apple!lsr