Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
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 and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcredll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycredll
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 first 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-017 Hewlett-Packard Company 5−133