Rand.RealPart of Rand module

Syntax   Rand.Real : real

Description   The Rand.Real function returns a pseudo-random number in the range zero to one. For example, if x is a real number, after x := Rand.Real, x would have a value such as 0.729548 or 0.352879.

Example   This program repeatedly and randomly prints out Hi ho, hi ho or It's off to work we go.

        loop
            if Rand.Real > 0.5 then
                put "Hi ho, hi ho"
            else
                put "It's off to work we go"
            end if
        end loop
Details   The Rand.Real function sets its parameter to the next value of a sequence of pseudo-random real numbers that approximates a uniform distribution over the range 0<r <1.

Each time a program runs, Rand.Real uses a different pseudo-random number sequence. To always get the same sequence (actually, to start the sequence at the same point), use the Rand.Set procedure.

To use several sequences of repeatable pseudo-random number sequences, use the Rand.Seed and Rand.Next procedures.

Status   Exported qualified.

This means that you can only call the function by calling Rand.Real, not by calling Real.

See also   Rand.Int, Rand.Set, Rand.Seed and Rand.Next.