Path: utzoo!attcan!uunet!ns-mx!iowasp.physics.uiowa.edu!maverick.ksu.ksu.edu!ux1.cso.uiuc.edu!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!psuvm!cxt105 From: CXT105@psuvm.psu.edu (Christopher Tate) Newsgroups: comp.sys.mac.programmer Subject: Re: Random number Generator wanted. Message-ID: <90193.212908CXT105@psuvm.psu.edu> Date: 13 Jul 90 01:29:08 GMT References: <1990Jun29.020739.9146@Neon.Stanford.EDU> <1990Jun30.170949.1426@Neon.Stanford.EDU> <8999@goofy.Apple.COM> <1990Jul6.182611.6371@eng.umd.edu> Organization: Penn State University Lines: 33 In article <1990Jul6.182611.6371@eng.umd.edu>, russotto@eng.umd.edu (Matthew T. Russotto) says: >In article <8999@goofy.Apple.COM> alexr@ucscb.ucsc.edu (Alexander M. >Rosenberg) >writes: >>Apple's random number generator uses the tick count as a seed upon each >>InitGraf (I may be wrong here, but I'm sure that it is time derived.) I do >>know that the mouse driver has always kept track of the time at which a >>click occurs, and takes the difference in time between that click and the >>previous one, and adds this number to the current randSeed. This is where >>an additional level of randomness is provided. (Humans tend to be more >>"random" than computers do, eh?) > >No. At least according to inside mac. The RandSeed is one. > >-- >Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu >][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions? > Hey! Bush has NO LIPS! When you call InitGraf(), it sets the seed for the Random() function to be 1. The way to get around this predictable initialization is to simply assign randSeed = TickCount() immediately afterwards. After that, Random() will have been initialized based on the system clock setting, and will therefore be (relatively) unpredictable. ------- Christopher Tate | | Of alle songes this is best: cxt105@psuvm.psu.edu | Verbum caro factum est! {...}!psuvax1!psuvm.bitnet!cxt105 | cxt105@psuvm.bitnet |