aboutsummaryrefslogtreecommitdiffstats
path: root/man3/rand.3
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2005-10-19 07:07:02 +0000
committerMichael Kerrisk <mtk.manpages@gmail.com>2005-10-19 07:07:02 +0000
commit63aa9df02fee88a559822c460ab5a30f1d8414ee (patch)
treefedc607745a57e06a1a541feca62e18d51523ddb /man3/rand.3
parente511ffb6bcaa9a584412a95e602435827e302033 (diff)
downloadman-pages-63aa9df02fee88a559822c460ab5a30f1d8414ee.tar.gz
Automated unformatting of parentheses using unformat_parens.sh
Diffstat (limited to 'man3/rand.3')
-rw-r--r--man3/rand.334
1 files changed, 17 insertions, 17 deletions
diff --git a/man3/rand.3 b/man3/rand.3
index c84af2769e..9fdf463a5a 100644
--- a/man3/rand.3
+++ b/man3/rand.3
@@ -49,39 +49,39 @@ rand, rand_r, srand \- pseudo-random number generator
.BI "void srand(unsigned int " seed );
.fi
.SH DESCRIPTION
-The \fBrand()\fP function returns a pseudo-random integer between 0
+The \fBrand\fP() function returns a pseudo-random integer between 0
and \fBRAND_MAX\fR.
.PP
-The \fBsrand()\fP function sets its argument as the seed for a new
-sequence of pseudo-random integers to be returned by \fBrand()\fP.
-These sequences are repeatable by calling \fBsrand()\fP with the same
+The \fBsrand\fP() function sets its argument as the seed for a new
+sequence of pseudo-random integers to be returned by \fBrand\fP().
+These sequences are repeatable by calling \fBsrand\fP() with the same
seed value.
.PP
-If no seed value is provided, the \fBrand()\fP function is automatically
+If no seed value is provided, the \fBrand\fP() function is automatically
seeded with a value of 1.
.PP
The function
-.B rand()
+.BR rand ()
is not reentrant or thread-safe, since it
uses hidden state that is modified on each call. This might just be
the seed value to be used by the next call, or it might be something
more elaborate. In order to get reproducible behaviour in a threaded
application, this state must be made explicit. The function
-.B rand_r()
+.BR rand_r ()
is supplied with a pointer to an unsigned int, to be used as state.
This is a very small amount of state, so this function will be a weak
pseudo-random generator. Try
.BR drand48_r (3)
instead.
.SH "RETURN VALUE"
-The \fBrand()\fP and \fBrand_r()\fP functions return a value
+The \fBrand\fP() and \fBrand_r\fP() functions return a value
between 0 and RAND_MAX.
-The \fBsrand()\fP function returns no value.
+The \fBsrand\fP() function returns no value.
.SH EXAMPLE
POSIX 1003.1-2003 gives the following example of an implementation of
-.B rand()
+.BR rand ()
and
-.BR srand() ,
+.BR srand (),
possibly useful when one needs the same sequence on two different machines.
.sp
.nf
@@ -98,11 +98,11 @@ possibly useful when one needs the same sequence on two different machines.
}
.fi
.SH NOTES
-The versions of \fBrand()\fP and \fBsrand()\fP in the Linux C Library use
-the same random number generator as \fBrandom()\fP and \fBsrandom()\fP, so
+The versions of \fBrand\fP() and \fBsrand\fP() in the Linux C Library use
+the same random number generator as \fBrandom\fP() and \fBsrandom\fP(), so
the lower-order bits should be as random as the higher-order bits.
However, on older
-.B rand()
+.BR rand ()
implementations, and on current implementations on different systems,
the lower-order bits are much less random than the higher-order bits.
Do not use this function in applications intended to be portable
@@ -143,12 +143,12 @@ volume 2 (Seminumerical Algorithms), 2nd ed.; Reading, Massachusetts:
Addison-Wesley Publishing Company, 1981.
.SH "CONFORMING TO"
The functions
-.B rand()
+.BR rand ()
and
-.B srand()
+.BR srand ()
conform to SVID 3, 4.3BSD, ISO 9899, POSIX 1003.1-2003.
The function
-.B rand_r()
+.BR rand_r ()
is from POSIX 1003.1-2003.
.SH "SEE ALSO"
.BR drand48 (3),