|
Randomize | ||
Randomize RandomSeed | ||
Parameters: RandomSeed = The value you wish to use to seed the random number generator. |
||
Returns: NONE | ||
The Randomize command is related to the random number generation. Randomize allows the user to seed (set) the random number generator so that it will produce a series of what appear to be random numbers. While Randomize may appear to produce random results to us humans, the results are in fact part of a 'set'. These number in the millions however, so it's unlike you'll noticed the set repeating, but they do repeat. This is not a PlayBASIC issue, it's an issue with how random number generation techniques are employed in computers. FACTS: * You can make the Random number generator produce the same results by seeding the generator with the user defined value. Eg. Randomize 57 This would seed the random generators set, so the sequence of numbers it produced would be the same every time. This can be handy when using random sequences to generate graphics for example, also known loosely as procedural generation. * NOTE: PlayBASIC automatically calls Randomize (seeded with the current Timer() value) each time your application is started. Mini Tutorial: Displaying a list of 10 random numbers between 50 and 100 (inclusive)
This example could output something like this. (could as it'll be random set of results each time you run the program)
|
Related Info: | Rnd | Rnd# | RndRange | RndRange# | Timer : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |