Next: Data Structures Up: Programming Utilities Previous: Numerical Utilities

Random Numbers

A simple random number package is provided, which produces a sequence of pseudo-random numbers based on a seed value, which totally determines the entire sequence of numbers. If the user does not set a seed, a seed is automatically created from the current time and date.


public  void  set_random_seed(
    int seed )

Sets the seed which determines the sequence of pseudo-random numbers.


public  int  get_random_int(
    int n )

Returns a random integer in the range zero to n-1.


public  Real  get_random_0_to_1( void )

Returns a random number greater than or equal to zero and strictly less than one.



Next: Data Structures Up: Programming Utilities Previous: Numerical Utilities


david@pet.mni.mcgill.ca
Fri Feb 17 15:40:04 EST 1995