drand48_r, erand48_r, lrand48_r, nrand48_r, mrand48_r, jrand48_r, srand48_r, seed48_r, lcong48_r -
Contents
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(), │ Thread safety │ MT-Safe race:buffer │
│ mrand48_r(), jrand48_r(), srand48_r(), seed48_r(), lcong48_r() │ │ │
└─────────────────────────────────────────────────────────────────┴───────────────┴─────────────────────┘
Description
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().
Library
Standard C library (libc, -lc)
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
Return Value
The return value is 0.
See Also
drand48(3), rand(3), random(3) Linux man-pages 6.9.1 2024-05-02 drand48_r(3)
Standards
GNU.
Synopsis
#include<stdlib.h>intdrand48_r(structdrand48_data*restrictbuffer,double*restrictresult);interand48_r(unsignedshortxsubi[3],structdrand48_data*restrictbuffer,double*restrictresult);intlrand48_r(structdrand48_data*restrictbuffer,long*restrictresult);intnrand48_r(unsignedshortxsubi[3],structdrand48_data*restrictbuffer,long*restrictresult);intmrand48_r(structdrand48_data*restrictbuffer,long*restrictresult);intjrand48_r(unsignedshortxsubi[3],structdrand48_data*restrictbuffer,long*restrictresult);intsrand48_r(longintseedval,structdrand48_data*buffer);intseed48_r(unsignedshortseed16v[3],structdrand48_data*buffer);intlcong48_r(unsignedshortparam[7],structdrand48_data*buffer); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): All functions shown above: /* glibc >= 2.19: */ _DEFAULT_SOURCE || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
See Also
🪘
Long Drum 