User Tools

Site Tools


jvs:cigal:manual:chapter3:random

CIGAL Reference Manual, Chapter 3 (Functions): random

Random -- Generate a random sequence of numbers

usage: buf = random(nvals,seed,scalfact,reptflg)

RANDOM generates a list of floating point numbers with pseudo-random values between 0.0 and 1.0. The list of numbers will be stored in the target BUF, which should be the name of a previously declared variable. The number of values generated is determined by the NVALS argument. NVALS must be specified unless the target variable (BUF) has a fixed size, in which case NVALS is set to the size of BUF.

If the SEED is non-zero then it is used to initiate the next set of values generated. A particular SEED value will always produce the same set of pseudo- random values. If the SEED is not specified (or 0), then each call to RANDOM will generate a new set of values.

If SCALFACT is specified and greater than 0, it is used as a scaling factor. Instead of values between 0 and 1, the returned values will be distributed over the interval 0 to SCALFACT.

REPTFLG is a flag to avoid generating repeated integer values. It can be:

   1 - the generated sequence will not have 2 successive values the same
        (Note: SCALFACT must be at least 2 for a REPTFLG of 1).
   2 - no value will be repeated until all SCALFACT values have been used.

See Also:
RAMP(3)

CIGAL Home, CIGAL Manual, Functions List, Manual Help

jvs/cigal/manual/chapter3/random.txt · Last modified: 2023/02/23 18:43 (external edit)