Randomize

Last Modified: 1/15/2021

Changes the Seed for the random number generator.

Arguments

NameTypeRequiredDescription
Seed Integer No If omitted, the HV counter will be used instead.

Example

Syntax: Randomize [<Seed>]
    Randomize
    a = Rnd(50)
    Print a

Remarks

Changing the Seed is essential for making sure that each number being coming out of the RNG is unique.

Having the same Seed throughout the program will yield the same pattern of numbers being generated. Ignoring a value for Seed will just substitute the video's HV counter instead.

A good way to make use of getting pure random numbers is to place a Randomize statement right after a JoyPad() call has detected a key. The HV counter will be in a random state when the hardware is turned on, but emulation generally has a constant value.

See Also

Rnd()