aboutsummaryrefslogtreecommitdiffstats
path: root/man3/rand.3
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2007-05-12 09:06:04 +0000
committerMichael Kerrisk <mtk.manpages@gmail.com>2007-05-12 09:06:04 +0000
commit60a90ecdae7bf6d1a91dc5d1d7177e400b114e47 (patch)
tree9f7c19a897084607a9688be5414d0d4cd6391b54 /man3/rand.3
parentd92a60f2575c95cd532b822e4fb983c3a9e35641 (diff)
downloadman-pages-60a90ecdae7bf6d1a91dc5d1d7177e400b114e47.tar.gz
Convert function formatting of the form "\fBname\fP()" to ".BR name ()".
Diffstat (limited to 'man3/rand.3')
-rw-r--r--man3/rand.341
1 files changed, 32 insertions, 9 deletions
diff --git a/man3/rand.3 b/man3/rand.3
index 933eba7be3..ef27552fbd 100644
--- a/man3/rand.3
+++ b/man3/rand.3
@@ -49,15 +49,24 @@ 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
+.BR rand ()
+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
+.BR srand ()
+function sets its argument as the seed for a new
+sequence of pseudo-random integers to be returned by
+.BR rand ().
+These sequences are repeatable by calling
+.BR srand ()
+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
+.BR rand ()
+function is automatically
seeded with a value of 1.
.PP
The function
@@ -78,9 +87,15 @@ Try
.BR drand48_r (3)
instead.
.SH "RETURN VALUE"
-The \fBrand\fP() and \fBrand_r\fP() functions return a value
+The
+.BR rand ()
+and
+.BR rand_r ()
+functions return a value
between 0 and RAND_MAX.
-The \fBsrand\fP() function returns no value.
+The
+.BR srand ()
+function returns no value.
.SH EXAMPLE
POSIX.1-2001 gives the following example of an implementation of
.BR rand ()
@@ -102,8 +117,16 @@ 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
+.BR rand ()
+and
+.BR srand ()
+in the Linux C Library use
+the same random number generator as
+.BR random ()
+and
+.BR srandom (),
+so
the lower-order bits should be as random as the higher-order bits.
However, on older
.BR rand ()