random(3)

MODULE
random - Pseudo Random Number Generation

DESCRIPTION

Random number generator. The method is attributed to B.A. Wichmann and I.D.Hill, in 'An efficient and portable pseudo-random number generator', Journal of Applied Statistics. AS183. 1982. Also Byte March 1987.

The current algorithm is a modification of the version attributed to Richard A O'Keefe in the standard Prolog library.

EXPORTS

seed() -> ran()

    Seeds random number generation with default values.

seed(A1, A2, A3) -> ran()

    Types
        A = A2 = A3 = int()

    Seeds random number generation with integer values.

uniform() -> float()

    Returns a random float uniformly distributed between 0.0 and 1.0.

uniform(N) -> int()

    Types
        N = int()

    Given an integer N >= 1, uniform(N) returns a random integer uniformly distributed between 1 and N.

Note

Uses the process dictionary variable random_seed to remember the current seed.

AUTHOR
Joe Armstrong - joe@erix.ericsson.se