Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!mips!hal!mark From: mark@mips.COM (Mark G. Johnson) Newsgroups: comp.sys.dec Subject: Re: Random numbers on PDP-11 Keywords: PDP-11 random numbers Message-ID: <39908@mips.mips.COM> Date: 5 Jul 90 14:22:04 GMT References: <19191@orstcs.CS.ORST.EDU> <1739@mountn.dec.com> <19207@orstcs.CS.ORST.EDU> Sender: news@mips.COM Reply-To: mark@mips.COM (Mark G. Johnson) Distribution: na Organization: MIPS Computer Systems, Inc. Lines: 22 In article <19207@orstcs.CS.ORST.EDU> kohler@jacobs.CS.ORST.EDU (kurt kohler) writes: >Thanks for the reply, but I guess I should have been more explicit. What >I wanted was a function that could be evaluated with the 16 bit arithmetic >on the PDP-11. Actually since all that is required is a 32 bit multiply >I could use it I suppose, it would just be more straight forward to >have 16 bit constants and a 16 bit result. Vol. 2 of Cookbook de la Knuth, 2nd edition, section 3.6, suggests some properties that your multiplier, modulus, and addend should have. The following choices have some of his suggested properties; read Knuth and see if you agree. X(0) := 31416 X(n+1) := [ (33573 * X(n)) + 4511 ] mod 65536 note: 2^16 = 65536, so the method above is suited for use on a binary computer with 16-bit wordlength. -- -- Mark Johnson MIPS Computer Systems, 930 E. Arques M/S 2-02, Sunnyvale, CA 94086 (408) 524-8308 mark@mips.com {or ...!decwrl!mips!mark}