SeedRandomizer (open)

Seed the randomizer

Syntax

// Core function, no LOADLIB necessary

INTEGER FUNCTION SeedRandomizer(INTEGER newseed)

Parameters

INTEGER newseed

The new seed value

Return value

INTEGER

The old current seed value: -1 if it hasn't been seeded yet

Description

Set the randomizer seed - by forcing the randomizer seed to a known value you can repeat random number sequences. If you call @link Random before seeding the randomizer, it is automatically seeded with the current time of day.

Examples

//Prints an (almost) unpredictable value
Print("Random: " || random(0,8) || "\n");
//Force the randomizer to generate a known sequence
SeedRandomizer(15);
//Always prints 7, which happens to be the first value after seed 15
Print("Random: " || random(0,8) || "\n");