|RAND(3)||Library Functions Manual||RAND(3)|
— bad pseudo-random number generator
To satisfy portable code,
be called to initialize the subsystem. In OpenBSD
the seed variable is ignored, and strong random number
results will be provided from
arc4random(3). In other systems, the
seed variable primes a simplistic deterministic
If the standardized behavior is required
can be substituted for
srand(), then subsequent
rand() calls will return results using the
deterministic algorithm. The deterministic sequence algorithm changed a
number of times since original development, is underspecified, and should
not be relied upon to remain consistent between platforms and over time.
function returns a result in the range of 0 to
RAND_MAX. By default, this result comes from
srand_deterministic() was called, the result will be
computed using the deterministic algorithm.
a thread-safe version of
rand(). Storage for the
seed must be provided through the seed argument, and
needs to have been initialized by the caller. It always operates using the
rand() function conforms to
rand_r() function conforms to
IEEE Std 1003.1-2008 (“POSIX.1”).
srand() function does not conform to
ANSI X3.159-1989 (“ANSI C89”),
srand_deterministic() function is an
srand() first appeared in
Version 3 AT&T UNIX.
|February 12, 2021||OpenBSD-current|