Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

Guardian Native C Library Calls (n - r) rand(3)
NAME
rand - Returns pseudorandom numbers
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
H-series OSS processes: /G/system/zdllnnn/zcredll
SYNOPSIS
#include <stdlib.h>
int rand (void);
DESCRIPTION
The rand( ) function returns successive pseudorandom numbers in the range from 0 (zero) to
RAND_MAX. The sequence of values returned depends on the seed value set with the srand()
function. If rand() is called before any calls to srand( ) have been made, the same sequence will
be generated as when srand( ) is rst called with a seed value of 1.
NOTES
The rand( ) function is a very simple random-number generator. Its spectral properties, the
mathematical measurement of how random the number sequence is, are weak.
RETURN VALUES
The rand( ) function returns the next pseudorandom number in the sequence.
ERRORS
None. This function does not set errno.
RELATED INFORMATION
Functions: srand(3).
527192-005 Hewlett-Packard Company 549