BB___RANDOMIZE

=RANDOMIZE= toc

Description
> This function sets the starting point of the random number generator, RND (//seeding// the generator). > Using same value, this will always return the same set of random numbers with each run of the program (great for debugging).

Syntax
> The //Number// must be in the range of 0 < n < 1. > It sometimes referred as //random seed//.
 * 1) RANDOMIZE //Number//

Hints
> If you do NOT issue RANDOMIZE command, JB supposed to start from random number (contrary to QBasic, that always started with same number)

> There were reports that restarting JB and not issuing RANDOMIZE gives numbers close on the same sequence. If it is important to you, you should seed generator yourself.

> When you don't seed the generator, it appears to continue the sequence from the previous run (the seed is stored somewhere).

> Small changes in seed used with RANDOMIZE very likely lead to small changes in next RND value. > **Workaround**: After while, sequences will run apart. So if you just discard some next 10 random numbers, that will take care of it.

Example
code format="lb" ' print a different set of numbers for each run For i = 1 To 10 Print INT(RND(0)*10) + 1 Next Print "---" ' print the same set of numbers for each run Randomize 0.5 For i = 1 To 10 Print INT(RND(0)*10) + 1 Next End code

Useful Functions
code format="lb" Place a useful function using this command here code