Description

Initializes the random number generator, for use with the Rnd function.

Syntax

InitRnd expression

Parameters

The InitRnd statement has the following parameter.

ParameterDescription
expressionAny legal expression. expression is used as a string, and sets a starting value for the next invocation of Rnd.

Because the Rnd function works with a specific algorithm, if you seed it with a particular value, then Rnd will generate the same series of random numbers, with each iteration. To ensure that Rnd generates a unique series of random numbers each time, seed it with a unique value (as, for example, that from the TimeDate() function).

Example

/* The present time and date set the random number generator with a unique value. */
 
InitRnd Time(): Date()
  • No labels