Open System Services System Calls Reference Manual (G06.28+, H06.05+)

rand_r(2) OSS System Calls Reference Manual
NAME
rand_r - Returns pseudorandom numbers (reentrant)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <stdlib.h>]
#include <spthread.h>
int rand_r (
unsigned int *seed );
PARAMETERS
seed Species the initial value on which random numbers should be based.
DESCRIPTION
The rand_r() function is the reentrant version of the rand( ) function.
The rand_r() function returns successive pseudorandom numbers in the range from 0 (zero) to
RAND_MAX.Ifrand_r() is called with the same initial value for the object pointed to by seed
and that object is not modified between successive returns and calls to rand_r(), the same
sequence is generated.
NOTES
The rand_r() 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_r() function returns the next pseudorandom number in the sequence.
ERRORS
No error values are returned. This function does not set the errno variable.
RELATED INFORMATION
Functions: rand(3).
STANDARDS CONFORMANCE
This function is an extension to the UNIX98 specification. Interfaces documented on this refer-
ence page conform to the following industry standards:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
The use of the header file spthread.h is an HP exception to the POSIX standard.
62 Hewlett-Packard Company 527186-007