ul does not interpret \u correctly
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Mon, 30 Sep 1985 05:47:08 +0000 (21:47 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Mon, 30 Sep 1985 05:47:08 +0000 (21:47 -0800)
SCCS-vsn: lib/libc/stdlib/rand.3 6.2
SCCS-vsn: lib/libc/stdlib/random.3 6.2

usr/src/lib/libc/stdlib/rand.3
usr/src/lib/libc/stdlib/random.3

index ebda84c..edceb33 100644 (file)
@@ -1,4 +1,4 @@
-.\"    @(#)rand.3      6.1 (Berkeley) %G%
+.\"    @(#)rand.3      6.2 (Berkeley) %G%
 .\"
 .TH RAND 3C ""
 .AT 3
 .\"
 .TH RAND 3C ""
 .AT 3
@@ -19,10 +19,13 @@ rand remains for compatibilty.
 .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
index ad5e04e..ec975ac 100644 (file)
@@ -2,7 +2,7 @@
 .\" 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
@@ -28,18 +28,22 @@ random, srandom, initstate, setstate \- better random number generator; routines
 .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
 value.
 .PP
 Unlike
 value.
 .PP
 Unlike
@@ -103,8 +107,10 @@ is that the size of the state array does not have to be remembered after
 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