2 .\" Copyright 2003 Walter Harms, 2004 Andries Brouwer <aeb@cwi.nl>.
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" Created 2004-10-31. Text taken from a page by Walter Harms, 2003-09-08
8 .TH drand48_r 3 (date) "Linux man-pages (unreleased)"
10 drand48_r, erand48_r, lrand48_r, nrand48_r, mrand48_r, jrand48_r,
11 srand48_r, seed48_r, lcong48_r
12 \- generate uniformly distributed pseudo-random numbers reentrantly
15 .RI ( libc ", " \-lc )
18 .B #include <stdlib.h>
20 .BI "int drand48_r(struct drand48_data *restrict " buffer ,
21 .BI " double *restrict " result );
22 .BI "int erand48_r(unsigned short " xsubi [3] ","
23 .BI " struct drand48_data *restrict "buffer ,
24 .BI " double *restrict " result ");"
26 .BI "int lrand48_r(struct drand48_data *restrict " buffer ,
27 .BI " long *restrict " result );
28 .BI "int nrand48_r(unsigned short " xsubi[3] ","
29 .BI " struct drand48_data *restrict "buffer ,
30 .BI " long *restrict " result ");"
32 .BI "int mrand48_r(struct drand48_data *restrict " buffer ,
33 .BI " long *restrict " result ");"
34 .BI "int jrand48_r(unsigned short " xsubi[3] ","
35 .BI " struct drand48_data *restrict " buffer ,
36 .BI " long *restrict " result ");"
38 .BI "int srand48_r(long int " seedval ", struct drand48_data *" buffer ");"
39 .BI "int seed48_r(unsigned short " seed16v[3] ", struct drand48_data *" buffer );
40 .BI "int lcong48_r(unsigned short " param[7] ", struct drand48_data *" buffer );
44 Feature Test Macro Requirements for glibc (see
45 .BR feature_test_macros (7)):
48 All functions shown above:
59 /* glibc >= 2.19: */ _DEFAULT_SOURCE
60 || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
63 These functions are the reentrant analogs of the functions described in
65 Instead of modifying the global random generator state, they use
69 Before the first use, this struct must be initialized, for example,
70 by filling it with zeros, or by calling one of the functions
76 The return value is 0.
78 For an explanation of the terms used in this section, see
84 Interface Attribute Value
97 T} Thread safety MT-Safe race:buffer