Last Modified: 1/15/2021
Changes the Seed for the random number generator.
Name | Type | Required | Description |
Seed | Integer | No | If omitted, the HV counter will be used instead. |
Syntax: Randomize [<Seed>] |
Randomize a = Rnd(50) Print a |
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.