]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 2003 Walter Harms, 2004 Andries Brouwer <aeb@cwi.nl>. |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
25 | .\" Created 2004-10-31. Text taken from a page by Walter Harms, 2003-09-08 | |
26 | .\" | |
4b8c67d9 | 27 | .TH DRAND48_R 3 2017-09-15 "GNU" "Linux Programmer's Manual" |
fea681da | 28 | .SH NAME |
c13182ef | 29 | drand48_r, erand48_r, lrand48_r, nrand48_r, mrand48_r, jrand48_r, |
fea681da MK |
30 | srand48_r, seed48_r, lcong48_r |
31 | \- generate uniformly distributed pseudo-random numbers reentrantly | |
32 | .SH SYNOPSIS | |
33 | .nf | |
34 | .B #include <stdlib.h> | |
68e4db0a | 35 | .PP |
fea681da | 36 | .BI "int drand48_r(struct drand48_data *" buffer ", double *" result ); |
68e4db0a | 37 | .PP |
fea681da | 38 | .BI "int erand48_r(unsigned short " xsubi [3] "," |
fea681da | 39 | .BI " struct drand48_data *"buffer ", double *" result ");" |
68e4db0a | 40 | .PP |
fea681da | 41 | .BI "int lrand48_r(struct drand48_data *" buffer ", long int *" result ); |
68e4db0a | 42 | .PP |
c13182ef | 43 | .BI "int nrand48_r(unsigned short int " xsubi[3] "," |
fea681da | 44 | .BI " struct drand48_data *"buffer ", long int *" result ");" |
68e4db0a | 45 | .PP |
fea681da | 46 | .BI "int mrand48_r(struct drand48_data *" buffer ",long int *" result ");" |
68e4db0a | 47 | .PP |
fea681da | 48 | .BI "int jrand48_r(unsigned short int " xsubi[3] "," |
fea681da | 49 | .BI " struct drand48_data *" buffer ", long int *" result ");" |
68e4db0a | 50 | .PP |
fea681da | 51 | .BI "int srand48_r(long int " seedval ", struct drand48_data *" buffer ");" |
68e4db0a | 52 | .PP |
c13182ef | 53 | .BI "int seed48_r(unsigned short int " seed16v[3] "," |
fea681da | 54 | .BI " struct drand48_data *" buffer ");" |
68e4db0a | 55 | .PP |
fea681da | 56 | .BI "int lcong48_r(unsigned short int " param[7] "," |
fea681da MK |
57 | .BI " struct drand48_data *" buffer ");" |
58 | .fi | |
68e4db0a | 59 | .PP |
cc4615cc MK |
60 | .in -4n |
61 | Feature Test Macro Requirements for glibc (see | |
62 | .BR feature_test_macros (7)): | |
63 | .in | |
68e4db0a | 64 | .PP |
cc4615cc | 65 | .ad l |
cfc2d88d | 66 | All functions shown above: |
cc4615cc MK |
67 | .\" .BR drand48_r (), |
68 | .\" .BR erand48_r (), | |
69 | .\" .BR lrand48_r (), | |
70 | .\" .BR nrand48_r (), | |
71 | .\" .BR mrand48_r (), | |
72 | .\" .BR jrand48_r (), | |
73 | .\" .BR srand48_r (), | |
74 | .\" .BR seed48_r (), | |
75 | .\" .BR lcong48_r (): | |
2b1b0424 MK |
76 | /* Glibc since 2.19: */ _DEFAULT_SOURCE |
77 | || /* Glibc versions <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE | |
cc4615cc | 78 | .ad b |
fea681da MK |
79 | .SH DESCRIPTION |
80 | These functions are the reentrant analogs of the functions described in | |
81 | .BR drand48 (3). | |
82 | Instead of modifying the global random generator state, they use | |
83 | the supplied data | |
84 | .IR buffer . | |
847e0d88 | 85 | .PP |
75b94dc3 | 86 | Before the first use, this struct must be initialized, for example, |
7b01461a | 87 | by filling it with zeros, or by calling one of the functions |
63aa9df0 MK |
88 | .BR srand48_r (), |
89 | .BR seed48_r (), | |
fea681da | 90 | or |
63aa9df0 | 91 | .BR lcong48_r (). |
47297adb | 92 | .SH RETURN VALUE |
fea681da | 93 | The return value is 0. |
8cb0cd82 | 94 | .SH ATTRIBUTES |
ffaf4916 MK |
95 | For an explanation of the terms used in this section, see |
96 | .BR attributes (7). | |
97 | .ad l | |
98 | .TS | |
99 | allbox; | |
5c753f32 | 100 | lbw25 lb lb |
ffaf4916 MK |
101 | l l l. |
102 | Interface Attribute Value | |
103 | T{ | |
8cb0cd82 PH |
104 | .BR drand48_r (), |
105 | .BR erand48_r (), | |
106 | .BR lrand48_r (), | |
107 | .BR nrand48_r (), | |
108 | .BR mrand48_r (), | |
109 | .BR jrand48_r (), | |
110 | .BR srand48_r (), | |
111 | .BR seed48_r (), | |
8cb0cd82 | 112 | .BR lcong48_r () |
08d587a0 | 113 | T} Thread safety MT-Safe race:buffer |
ffaf4916 MK |
114 | .TE |
115 | .ad | |
47297adb | 116 | .SH CONFORMING TO |
fea681da | 117 | These functions are GNU extensions and are not portable. |
47297adb | 118 | .SH SEE ALSO |
fea681da MK |
119 | .BR drand48 (3), |
120 | .BR rand (3), | |
121 | .BR random (3) |