NAME
drand48_r, erand48_r, lrand48_r, nrand48_r, mrand48_r, jrand48_r, srand48_r, seed48_r, lcong48_r - generate uniformly distributed pseudo-random numbers reentrantly
LIBRARY
Standard C library (libc, -lc)
SYNOPSIS
#include <stdlib.h>int drand48_r(struct drand48_data *restrict \nbuffer\n,\n
\n double *restrict \nresult\n);\n
\nint erand48_r(unsigned short \nxsubi\n[3]\n,\n
\n struct drand48_data *restrict \nbuffer\n,\n
\n double *restrict \nresult\n);int lrand48_r(struct drand48_data *restrict \nbuffer\n,\n
\n long *restrict \nresult\n);\n
\nint nrand48_r(unsigned short \nxsubi[3]\n,\n
\n struct drand48_data *restrict \nbuffer\n,\n
\n long *restrict \nresult\n);int mrand48_r(struct drand48_data *restrict \nbuffer\n,\n
\n long *restrict \nresult\n);\n
\nint jrand48_r(unsigned short \nxsubi[3]\n,\n
\n struct drand48_data *restrict \nbuffer\n,\n
\n long *restrict \nresult\n);int srand48_r(long int \nseedval\n, struct drand48_data *\nbuffer\n);\n
\nint seed48_r(unsigned short \nseed16v[3]\n, struct drand48_data *\nbuffer\n);\n
\nint lcong48_r(unsigned short \nparam[7]\n, struct drand48_data *\nbuffer\n);All functions shown above:
\n
/* glibc >= 2.19: */ _DEFAULT_SOURCE
\n
|| /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCEDESCRIPTION
These functions are the reentrant analogs of the functions described in drand48(3). Instead of modifying the global random generator state, they use the supplied data buffer.
Before the first use, this struct must be initialized, for example, by filling it with zeros, or by calling one of the functions srand48_r(), seed48_r(), or lcong48_r().
RETURN VALUE
The return value is 0.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
| Interface | Attribute | Value |
| drand48_r (), erand48_r (), lrand48_r (), nrand48_r (), mrand48_r (), jrand48_r (), srand48_r (), seed48_r (), lcong48_r () | Thread safety | MT-Safe race:buffer |
STANDARDS
GNU.
SEE ALSO
drand48(3), rand(3), random(3)