Open System Services Library Calls Reference Manual (G06.27+, H06.04+)

OSS 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).
527187-004 Hewlett-Packard Company 561