1drand48_r(3)               Library Functions Manual               drand48_r(3)
2
3
4

NAME

6       drand48_r,   erand48_r,  lrand48_r,  nrand48_r,  mrand48_r,  jrand48_r,
7       srand48_r, seed48_r, lcong48_r - generate uniformly distributed pseudo-
8       random numbers reentrantly
9

LIBRARY

11       Standard C library (libc, -lc)
12

SYNOPSIS

14       #include <stdlib.h>
15
16       int drand48_r(struct drand48_data *restrict buffer,
17                     double *restrict result);
18       int erand48_r(unsigned short xsubi[3],
19                     struct drand48_data *restrict buffer,
20                     double *restrict result);
21
22       int lrand48_r(struct drand48_data *restrict buffer,
23                     long *restrict result);
24       int nrand48_r(unsigned short xsubi[3],
25                     struct drand48_data *restrict buffer,
26                     long *restrict result);
27
28       int mrand48_r(struct drand48_data *restrict buffer,
29                     long *restrict result);
30       int jrand48_r(unsigned short xsubi[3],
31                     struct drand48_data *restrict buffer,
32                     long *restrict result);
33
34       int srand48_r(long int seedval, struct drand48_data *buffer);
35       int seed48_r(unsigned short seed16v[3], struct drand48_data *buffer);
36       int lcong48_r(unsigned short param[7], struct drand48_data *buffer);
37
38   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
39
40       All functions shown above:
41           /* glibc >= 2.19: */ _DEFAULT_SOURCE
42               || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
43

DESCRIPTION

45       These functions are the reentrant analogs of the functions described in
46       drand48(3).  Instead of modifying the global  random  generator  state,
47       they use the supplied data buffer.
48
49       Before  the first use, this struct must be initialized, for example, by
50       filling it with zeros, or by calling one of the functions  srand48_r(),
51       seed48_r(), or lcong48_r().
52

RETURN VALUE

54       The return value is 0.
55

ATTRIBUTES

57       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
58       tributes(7).
59
60       ┌────────────────────────────────┬───────────────┬─────────────────────┐
61Interface                       Attribute     Value               
62       ├────────────────────────────────┼───────────────┼─────────────────────┤
63drand48_r(), erand48_r(),       │ Thread safety │ MT-Safe race:buffer │
64lrand48_r(), nrand48_r(),       │               │                     │
65mrand48_r(), jrand48_r(),       │               │                     │
66srand48_r(), seed48_r(),        │               │                     │
67lcong48_r()                     │               │                     │
68       └────────────────────────────────┴───────────────┴─────────────────────┘
69

STANDARDS

71       GNU.
72

SEE ALSO

74       drand48(3), rand(3), random(3)
75
76
77
78Linux man-pages 6.04              2023-03-30                      drand48_r(3)
Impressum