SCCS-vsn: lib/libc/stdlib/rand.3 6.2
SCCS-vsn: lib/libc/stdlib/random.3 6.2
-.\" @(#)rand.3 6.1 (Berkeley) %G%
+.\" @(#)rand.3 6.2 (Berkeley) %G%
.PP
.I Rand
uses a multiplicative congruential
.PP
.I Rand
uses a multiplicative congruential
-random number generator
-with period 2\u\s732\s0\d
+random number generator with period
+.if t 2\u\s732\s0\d
+.if n 2**32
to return successive pseudo-random
to return successive pseudo-random
-numbers in the range from 0 to 2\u\s731\s10\d\-1.
+numbers in the range from 0 to
+.if t 2\u\s731\s10\d\(mi1.
+.if n (2**31)\(mi1
.PP
The generator is reinitialized by calling
.I srand
.PP
The generator is reinitialized by calling
.I srand
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
-.\" @(#)random.3 6.1 (Berkeley) %G%
+.\" @(#)random.3 6.2 (Berkeley) %G%
.\"
.TH RANDOM 3 ""
.UC 5
.\"
.TH RANDOM 3 ""
.UC 5
.I Random
uses a non-linear additive feedback random number generator employing a
default table of size 31 long integers to return successive pseudo-random
.I Random
uses a non-linear additive feedback random number generator employing a
default table of size 31 long integers to return successive pseudo-random
-numbers in the range from 0 to 2\u\s731\s10\d\-1. The period of this
-random number generator is very large, approximately 16*(2\u\s731\s10\d\-1).
+numbers in the range from 0 to
+.if t 2\u\s731\s10\d\(mi1.
+.if n (2**31)\(mi1.
+The period of this random number generator is very large, approximately
+.if t 16\(mu(2\u\s731\s10\d\(mi1).
+.if n 16*((2**31)\(mi1).
.PP
.I Random/srandom
have (almost) the same calling sequence and initialization properties as
.I rand/srand.
The difference is that
.IR rand (3)
.PP
.I Random/srandom
have (almost) the same calling sequence and initialization properties as
.I rand/srand.
The difference is that
.IR rand (3)
-produces a much less random sequence -- in fact, the low dozen bits
+produces a much less random sequence \(em in fact, the low dozen bits
generated by rand go through a cyclic pattern. All the bits generated by
.I random
generated by rand go through a cyclic pattern. All the bits generated by
.I random
-are usable. For example, \*(lqrandom()&01\*(rq will produce a random binary
+are usable. For example, ``random()&01'' will produce a random binary
it is initialized.
.PP
With 256 bytes of state information, the period of the random number
it is initialized.
.PP
With 256 bytes of state information, the period of the random number
-generator is greater than 2\u\s769\s10\d, which should be sufficient for
-most purposes.
+generator is greater than
+.if t 2\u\s769\s10\d,
+.if n 2**69
+which should be sufficient for most purposes.
.SH AUTHOR
Earl T. Cohen
.SH DIAGNOSTICS
.SH AUTHOR
Earl T. Cohen
.SH DIAGNOSTICS