Quote:

>I am trying to make a small game. In this game, you have to look at a

>frequency drawing of an alien race and then see if a randomly picked

>drawing looks similar. Would I use the Randomize timer for this? And

>if so, how?

It is a good idea to use RANDOMIZE TIMER to ensure that the random

number generator is seeded with a new value each time the program is

run.

See, computers can't really generate random numbers, they generate a

pseudo-random sequence of numbers. The algorithm that does this needs

a "seed" value to start the sequence of "random" numbers. Given the

same seed value, the sequence of "random" numbers will be the same.

To see this, try this code:

FOR i% = 1 TO 10

PRINT ((10 - 1 + 1) * RND + 1) ' generate a random number

' between 1 and 10

NEXT i%

Every time you run it, you will get the same sequence of "random"

numbers. The numbers will look random, compared to each other, but

they will be exactly the same for each run.

Now, run this code:

RANDOMIZE TIMER ' seed the RDN function with the time of day

FOR i% = 1 TO 10

PRINT ((10 - 1 + 1) * RND + 1)

NEXT i%

Each time you run this code you will get a different sequence of

"random" numbers. The RANDOMIZE TIMER function takes the time of day

(TIMER) as the seed for the random number generator, ensuring that it

produces a different sequence each time.

Actually, if the software is run at the exact same time each day, it

will still produce the same sequence. I suppose one could futz with

the result of the TIMER command (maybe multiply or divide it by the

Julian day of the year?). But given the resolution of the TIMER

function, this shouldn't really be necessary.