TIP: Click on subject to list as thread! ANSI
echo: commo
to: CARL MORRIS
from: CHUCK SEYBOLDT
date: 1995-05-31 01:12:00
subject: Re: Random Number Generat

CM>  Random number generation.  Variable _RND_TAB is permanent, do
CM>  not use it! Enter RANDOM with _r_min set to minimum value and
CM>  _r_max set to the maximum value.  Return is in _r_rnd.
Carl,
        Nice routine.  What you are basically doing is using the
previous random number as the seed for the next one ... here are the
guts of the random number generator, from both versions that you
have shared so far.
CM> {:rnd_start}
CM>         {mult _rnd_tab,1255}
CM>         {incr _rnd_tab,6173}
CM>         {divi _rnd_tab,29282}
CM>         {setv _rnd_tab,%_rem} {retu}
CM> 
CM>         {mult _rnd_tab,1256}
CM>         {incr _rnd_tab,6173}
CM>         {divi _rnd_tab,65535}
.
        Using 1256, 6173, and 65535, I got a loop that repeated
after 640 numbers (tried with several seeds).  This is obviously
undesirable.
.
        Using 1255, 6173, and 29282, results look much better!!
I specifically looked for the first random number to be present a
second time and it DID appear after 29279 numbers.  FWIW, Commo
wrote 39,000 numbers in 8 minutes on my 486/33 running DV.  I have a
sort running so I can search for duplicate/missing numbers and will
report on that separately.
.
        Using 1255, 6173, and 65535 repeated on a 96 number long
cycle.  There's a pattern in there .. but I'll be dipped if I can
figure it out.  I am picturing a loop/roulette wheel with the
multiply then increment rule that somehow lands once on each
compartment in a certain "random" pattern.
.
        I think a suitable seed (to initialize the generator) is
simply the %_sec variable, once you get into this random number
generator, it hops around quite well.
.
        Thanks for the details and a nice randomizer!
.
05/25/95   20:08                                        ChuckůS
.
Carl,
.
        Finally got the complete list of numbers that this series
produces, and it indeed makes one of each number from 0 to 29281!
Neat thing is they are in a pseudo-random order.
.
        I don't know any other three numbers that share this
property, so for now this routine should use EXACTLY those values.
.
        It took Qedit almost an hour to sort the list into numerical
order!  The list is 193,864 bytes; 29,282 lines.
05/31/95   00:02                                        ChuckůS
-*-
 ţ JABBER v1.3á1 #á021 ţ {COMMO} a new standard in telecommunications.
--- Opus-CBCS 1.7x via O_QWKer 1.1
---------------
* Origin: BlinkLink - Perceiving is believing! 412-766-0732 (1:129/89.0)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.