1 .\" Copyright 2003 Walter Harms, 2004 Andries Brouwer <aeb@cwi.nl>.
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" Created 2004-10-31. Text taken from a page by Walter Harms, 2003-09-08
7 .TH DRAND48_R 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
9 drand48_r, erand48_r, lrand48_r, nrand48_r, mrand48_r, jrand48_r,
10 srand48_r, seed48_r, lcong48_r
11 \- generate uniformly distributed pseudo-random numbers reentrantly
14 .RI ( libc ", " \-lc )
17 .B #include <stdlib.h>
19 .BI "int drand48_r(struct drand48_data *restrict " buffer ,
20 .BI " double *restrict " result );
21 .BI "int erand48_r(unsigned short " xsubi [3] ","
22 .BI " struct drand48_data *restrict "buffer ,
23 .BI " double *restrict " result ");"
25 .BI "int lrand48_r(struct drand48_data *restrict " buffer ,
26 .BI " long *restrict " result );
27 .BI "int nrand48_r(unsigned short " xsubi[3] ","
28 .BI " struct drand48_data *restrict "buffer ,
29 .BI " long *restrict " result ");"
31 .BI "int mrand48_r(struct drand48_data *restrict " buffer ,
32 .BI " long *restrict " result ");"
33 .BI "int jrand48_r(unsigned short " xsubi[3] ","
34 .BI " struct drand48_data *restrict " buffer ,
35 .BI " long *restrict " result ");"
37 .BI "int srand48_r(long int " seedval ", struct drand48_data *" buffer ");"
38 .BI "int seed48_r(unsigned short " seed16v[3] ", struct drand48_data *" buffer );
39 .BI "int lcong48_r(unsigned short " param[7] ", struct drand48_data *" buffer );
43 Feature Test Macro Requirements for glibc (see
44 .BR feature_test_macros (7)):
47 All functions shown above:
58 /* Glibc since 2.19: */ _DEFAULT_SOURCE
59 || /* Glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
62 These functions are the reentrant analogs of the functions described in
64 Instead of modifying the global random generator state, they use
68 Before the first use, this struct must be initialized, for example,
69 by filling it with zeros, or by calling one of the functions
75 The return value is 0.
77 For an explanation of the terms used in this section, see
85 Interface Attribute Value
96 T} Thread safety MT-Safe race:buffer
102 These functions are GNU extensions and are not portable.