changequote({,}) define({_TITLE_},{Varkon MBS Programmers manual}) define({_SUBTITLE_},{- random - Function}) define({_INDEXLINK_},{index}) define({_STYLE_},{../varkonstyle.css}) include(../../include/header.inc)

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.

include(../../include/svnversion.inc) include(../../include/footer.inc)