[futurebasic] Re: [FB] HandleEvents, Random seed and PG:PRO

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

From: Robert Purves <robert.purves@...>
Date: Sat, 26 Jun 1999 14:16:20 +1200
>Question 2
>
>I have been in the habit of having just one RANDOM line in my initMain
>function.
>I then assumed that all subsequent RND calls in various .FLTR files would
>continue on from the original random seed plus any previous RND calls.
>
>However I am getting reports from classroom labs running the software that
>they are all getting the same sequences.  (That is the function is not
>randomly seeded from the clock).   What is the best practice for RND calls?

In plain FB (I don't know about PG), the following gives a different
sequence each time the program is run.

WINDOW 1
RANDOM
FOR j=1 TO 10
  PRINT RND(10)
NEXT
DO: UNTIL FN BUTTON

but if you put RANDOM 1376 (for example) in place of RANDOM, the same
sequence is generated each time.

Robert Purves