
need help randomizing on GWBASIC
On Thu, 06 Dec 2001 06:24:41 GMT, "Robert Nolan"
Quote:
>Does anyone know of a way to randomize on GWBASIC.
>I am using the rnd() function, but everytime I run I get the same set of
>numbers.
>I have misplaced my book and I think it is in a box in the garage. Haven't
>used it in 3-4 years.
Before your first call to RND(), execute a
RANDOMIZE TIMER
statement. The pseudorandom number generator needs a "seed" value to
start the sequence, and the default seed is a constant. RANDOMIZE
reseeds the generator with the number you specify. Using TIMER (which
holds the number of seconde since the last clock rollover, which may
or may not have been last midnight) is the standard way to get an
unpredictable sequence.