]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/drand48_r.3
9beb81179b32c8936eeaeb45f602d29e57ab1cc1
[thirdparty/man-pages.git] / man3 / drand48_r.3
1 .\" Copyright 2003 Walter Harms, 2004 Andries Brouwer <aeb@cwi.nl>.
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .\" Created 2004-10-31. Text taken from a page by Walter Harms, 2003-09-08
6 .\"
7 .TH DRAND48_R 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
8 .SH NAME
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
12 .SH LIBRARY
13 Standard C library
14 .RI ( libc ", " \-lc )
15 .SH SYNOPSIS
16 .nf
17 .B #include <stdlib.h>
18 .PP
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 ");"
24 .PP
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 ");"
30 .PP
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 ");"
36 .PP
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 );
40 .fi
41 .PP
42 .RS -4
43 Feature Test Macro Requirements for glibc (see
44 .BR feature_test_macros (7)):
45 .RE
46 .PP
47 All functions shown above:
48 .\" .BR drand48_r (),
49 .\" .BR erand48_r (),
50 .\" .BR lrand48_r (),
51 .\" .BR nrand48_r (),
52 .\" .BR mrand48_r (),
53 .\" .BR jrand48_r (),
54 .\" .BR srand48_r (),
55 .\" .BR seed48_r (),
56 .\" .BR lcong48_r ():
57 .nf
58 /* Glibc since 2.19: */ _DEFAULT_SOURCE
59 || /* Glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
60 .fi
61 .SH DESCRIPTION
62 These functions are the reentrant analogs of the functions described in
63 .BR drand48 (3).
64 Instead of modifying the global random generator state, they use
65 the supplied data
66 .IR buffer .
67 .PP
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
70 .BR srand48_r (),
71 .BR seed48_r (),
72 or
73 .BR lcong48_r ().
74 .SH RETURN VALUE
75 The return value is 0.
76 .SH ATTRIBUTES
77 For an explanation of the terms used in this section, see
78 .BR attributes (7).
79 .ad l
80 .nh
81 .TS
82 allbox;
83 lbx lb lb
84 l l l.
85 Interface Attribute Value
86 T{
87 .BR drand48_r (),
88 .BR erand48_r (),
89 .BR lrand48_r (),
90 .BR nrand48_r (),
91 .BR mrand48_r (),
92 .BR jrand48_r (),
93 .BR srand48_r (),
94 .BR seed48_r (),
95 .BR lcong48_r ()
96 T} Thread safety MT-Safe race:buffer
97 .TE
98 .hy
99 .ad
100 .sp 1
101 .SH STANDARDS
102 These functions are GNU extensions and are not portable.
103 .SH SEE ALSO
104 .BR drand48 (3),
105 .BR rand (3),
106 .BR random (3)