summaryrefslogtreecommitdiffstats
path: root/man3/drand48.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/drand48.3')
-rw-r--r--man3/drand48.343
1 files changed, 21 insertions, 22 deletions
diff --git a/man3/drand48.3 b/man3/drand48.3
index b768d0d..18123b0 100644
--- a/man3/drand48.3
+++ b/man3/drand48.3
@@ -8,7 +8,7 @@
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\" 386BSD man pages
.\" Modified Sat Jul 24 19:46:03 1993 by Rik Faith (faith@cs.unc.edu)
-.TH drand48 3 2023-07-20 "Linux man-pages 6.05.01"
+.TH drand48 3 2023-10-31 "Linux man-pages 6.7"
.SH NAME
drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48,
lcong48 \- generate uniformly distributed pseudo-random numbers
@@ -18,26 +18,26 @@ Standard C library
.SH SYNOPSIS
.nf
.B #include <stdlib.h>
-.PP
+.P
.B double drand48(void);
.BI "double erand48(unsigned short " xsubi [3]);
-.PP
+.P
.B long lrand48(void);
.BI "long nrand48(unsigned short " xsubi [3]);
-.PP
+.P
.B long mrand48(void);
.BI "long jrand48(unsigned short " xsubi [3]);
-.PP
+.P
.BI "void srand48(long " seedval );
.BI "unsigned short *seed48(unsigned short " seed16v [3]);
.BI "void lcong48(unsigned short " param [7]);
.fi
-.PP
+.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
-.PP
+.P
All functions shown above:
.\" .BR drand48 (),
.\" .BR erand48 (),
@@ -56,7 +56,7 @@ All functions shown above:
.SH DESCRIPTION
These functions generate pseudo-random numbers using the linear congruential
algorithm and 48-bit integer arithmetic.
-.PP
+.P
The
.BR drand48 ()
and
@@ -64,21 +64,21 @@ and
functions return nonnegative
double-precision floating-point values uniformly distributed over the interval
[0.0,\ 1.0).
-.PP
+.P
The
.BR lrand48 ()
and
.BR nrand48 ()
functions return nonnegative
long integers uniformly distributed over the interval [0,\ 2\[ha]31).
-.PP
+.P
The
.BR mrand48 ()
and
.BR jrand48 ()
functions return signed long
integers uniformly distributed over the interval [\-2\[ha]31,\ 2\[ha]31).
-.PP
+.P
The
.BR srand48 (),
.BR seed48 (),
@@ -97,17 +97,17 @@ and
.BR jrand48 ()
do not require
an initialization function to be called first.
-.PP
+.P
All the functions work by generating a sequence of 48-bit integers,
.IR Xi ,
according to the linear congruential formula:
-.PP
+.P
.in +4n
.EX
.B Xn+1 = (aXn + c) mod m, where n >= 0
.EE
.in
-.PP
+.P
The parameter
.I m
= 2\[ha]48, hence 48-bit integer arithmetic is performed.
@@ -118,14 +118,14 @@ is called,
and
.I c
are given by:
-.PP
+.P
.in +4n
.EX
.B a = 0x5DEECE66D
.B c = 0xB
.EE
.in
-.PP
+.P
The value returned by any of the functions
.BR drand48 (),
.BR erand48 (),
@@ -143,7 +143,7 @@ be returned, is copied from the high-order bits of
.I Xi
and transformed
into the returned value.
-.PP
+.P
The functions
.BR drand48 (),
.BR lrand48 (),
@@ -169,7 +169,7 @@ value of
.I Xi
into the array before calling the function for the first
time.
-.PP
+.P
The initializer function
.BR srand48 ()
sets the high order 32-bits of
@@ -178,7 +178,7 @@ to the argument
.IR seedval .
The low order 16-bits are set
to the arbitrary value 0x330E.
-.PP
+.P
The initializer function
.BR seed48 ()
sets the value of
@@ -192,7 +192,7 @@ previous value of
is copied into an internal buffer and a
pointer to this buffer is returned by
.BR seed48 ().
-.PP
+.P
The initialization function
.BR lcong48 ()
allows the user to specify
@@ -249,8 +249,7 @@ T} Thread safety T{
MT-Unsafe race:drand48
T}
.TE
-.sp 1
-.PP
+.P
The above
functions record global state information for the random number generator,
so they are not thread-safe.