Amos Professional Manual  Contents  Index

Maths


This may well be acceptable for arcade games, where pre-set random patterns generated by RND can be used to advantage, but it is a useless system for more serious applications.

The RANDOMIZE command solves this problem by setting the value of the seed directly. This seed can be any value you choose, and each seed will generate an individual sequence of numbers. RANDOMIZE can also be used in conjunction with the TIMER variable, to generate genuine random numbers.

TIMER
reserved variable: count in 50ths of a second
v=Timer
Timer=v

The TIMER reserved variable is incremented by 1 unit every 50th of a second, in other words, it returns the amount of time that has elapsed since your Amiga was last switched on. As explained above, this makes it a perfect "seed" to be used with the RANDOMIZE function, as follows:

X> Randomize Timer

The best place to use this technique is immediately after the user has entered some data into the computer. Even a simple key-press to start a game will work perfectly, and generate truly random numbers.

Back    Next
05.03.11