Re: [TML] The Lunion Project, resend
shadow@xxxxxx 11 Jan 2017 04:48 UTC
On 9 Jan 2017 at 20:24, Phil Pugliese (via tml list) wrote:
> Speaking of random number generators, the first mainframe I learned
> BASIC on defaulted, purportedly for testing/debugging purposes, to a
> fixed list of random numbers unless an override cmd, RANDOMIZE, was
> inserted at the beginning of the program!
A lot of BASICs work like this:
RND(0) generates a random floating point value from 0 to
.999999999...
RND(-number) sets the random seed to number.
And some have RND(integer) gives random integer from 1 to integer
But that bit with resetting the seed is *very* useful. It let's you
repeat a set of random numbers to test things.
But the "right" way to test routines that generate stuff according to
die rolls is to generate the values first then run thru the routine.
IE
R1 = rnd(6)
R2 = rnd(6)
R3 = rnd(6)
...
[routine goes here]
This lets you test the routine by replacing the "rools for a set of
nested for-next loops.
That way you run thru all possible combinations and will find out
about any "gotchas".
--
Leonard Erickson (aka shadow)
shadow at shadowgard dot com