[futurebasic] Re: [FB] Re: Random File List

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1999 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Tue, 5 Oct 1999 20:03:18 +1300
>Every so often, my *random* numbers seemed to get caught in a loop of
>length between 5 and 9, even when re-seeding the RND function before
>each call to the function.  Very weird.

It is important _not_ to reseed a random number generator on the fly. In
most systems, the seed is generated from reading a clock, so that repeated
seedings give strongly correlated starting values, or even the same value.
Reseeding does not increase randomness; it _reduces_ it.

In FB^3, for instance, RANDOM[IZE] seeds the random number generator from
the MacOS seconds counter:

gFBRndSeed& = [_Time]  //Seed Random number generator

Since [_Time] changes only every second, the hazard of reseeding within a
program should be obvious. Use RANDOM[IZE] at most once in your program, at
start-up time.

Robert Purves