1DRAND48_R(3) Linux Programmer's Manual DRAND48_R(3)
2
3
4
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
11 #include <stdlib.h>
12
13 int drand48_r(struct drand48_data *buffer, double *result);
14
15 int erand48_r(unsigned short xsubi[3],
16 struct drand48_data *buffer, double *result);
17
18 int lrand48_r(struct drand48_data *buffer, long int *result);
19
20 int nrand48_r(unsigned short int xsubi[3],
21 struct drand48_data *buffer, long int *result);
22
23 int mrand48_r(struct drand48_data *buffer,long int *result);
24
25 int jrand48_r(unsigned short int xsubi[3],
26 struct drand48_data *buffer, long int *result);
27
28 int srand48_r(long int seedval, struct drand48_data *buffer);
29
30 int seed48_r(unsigned short int seed16v[3],
31 struct drand48_data *buffer);
32
33 int lcong48_r(unsigned short int param[7],
34 struct drand48_data *buffer);
35
36 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
37
38 All functions shown above:
39 /* Glibc since 2.19: */ _DEFAULT_SOURCE
40 || /* Glibc versions <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
41
43 These functions are the reentrant analogs of the functions described in
44 drand48(3). Instead of modifying the global random generator state,
45 they use the supplied data buffer.
46
47 Before the first use, this struct must be initialized, for example, by
48 filling it with zeros, or by calling one of the functions srand48_r(),
49 seed48_r(), or lcong48_r().
50
52 The return value is 0.
53
55 For an explanation of the terms used in this section, see
56 attributes(7).
57
58 ┌──────────────────────────┬───────────────┬─────────────────────┐
59 │Interface │ Attribute │ Value │
60 ├──────────────────────────┼───────────────┼─────────────────────┤
61 │drand48_r(), erand48_r(), │ Thread safety │ MT-Safe race:buffer │
62 │lrand48_r(), nrand48_r(), │ │ │
63 │mrand48_r(), jrand48_r(), │ │ │
64 │srand48_r(), seed48_r(), │ │ │
65 │lcong48_r() │ │ │
66 └──────────────────────────┴───────────────┴─────────────────────┘
68 These functions are GNU extensions and are not portable.
69
71 drand48(3), rand(3), random(3)
72
74 This page is part of release 5.02 of the Linux man-pages project. A
75 description of the project, information about reporting bugs, and the
76 latest version of this page, can be found at
77 https://www.kernel.org/doc/man-pages/.
78
79
80
81GNU 2017-09-15 DRAND48_R(3)