Re: A92: random number


[Prev][Next][Index][Thread]

Re: A92: random number




Thank you very much Arno.

MP <philhuck@club-internet.fr>

-----Message d'origine-----
De : Arno Kizina <Arno.Kizina@t-online.de>
À : assembly-92@lists.ticalc.org <assembly-92@lists.ticalc.org>
Date : jeudi 10 septembre 1998 00:46
Objet : Re: A92: random number



Robert Caldwell schrieb:
>
> {{Thank you for your help, but I didn't mean that exactly. I wanted to
> know an
> algorithm to generate random numbers, for example with a pen and a sheet
> of
> paper, and then how to code this algorithm in assembly for Fargo. Thanx.
> MP}}
>
>
>
> I have the formulas to calculate the two seed numbers, but I could never
> figure out how to get from the 2 seed numbers to the random number.  So,
> if anyone knows how to do this I would appreciate the algorithm, also.

Take two integers c and m both positive and a third one: z0. Get z1 = c*z0
mod m
and so on replacing z0 by z1 by z2.... zi/m can be used as a pseudo random
number between 0 and 1, taken from "Taschenbuch der Mathematik", Bronstein,
Semendjajew
if you take c= 1993 , m=12893 ,z0=17 you get z1=8095(rand:0.62786),
z2=8685...
A.K.
>
> -Rob
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com