index

Varkon MBS Programmers manual


random - Function

Description

Generates a pseudo random number x in the range 0.0 <= x <= 1.0.

Syntax

  x:=random(seed);

  float x;
  float seed;

Principal parameters

None.

Optional parameters

seed - A start value 0.0 <= seed <= 1.0

Return value

A random FLOAT value x in the range 0.0 <= x <= 1.0.

Comment

If no seed is given, each call to random() will return a new random value based on a default seed of zero. If a seed is supplied in the first call to random(), consecutive calls (without seed) will return a different series of random numbers. Note that a seed should only be supplied once as each call to random() with the same seed will return the same random number.

For a given seed, random() will always return the same series of random numbers. One way to make random "more random" is to use something "really random" as a seed. The time of the day is one possibility.


SourceForge.net Logo

Varkon 1.19D svn # 120M