diff options
| author | fair <fair@NetBSD.org> | 1998-04-28 21:19:49 +0000 |
|---|---|---|
| committer | fair <fair@NetBSD.org> | 1998-04-28 21:19:49 +0000 |
| commit | aba63e6a510a2e9bfe6a583b982a2eafeb4b0a5f (patch) | |
| tree | 0bf2b107dbbd672be8bae3c2b33498ffc6f658f1 /lib/libc/stdlib/rand48.3 | |
| parent | a27dd1341b52c927c80f49b0baed1669d62cb749 (diff) | |
fix mdoc references and mistakes
Diffstat (limited to 'lib/libc/stdlib/rand48.3')
| -rw-r--r-- | lib/libc/stdlib/rand48.3 | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/libc/stdlib/rand48.3 b/lib/libc/stdlib/rand48.3 index a500c4d3693..cebaa08382e 100644 --- a/lib/libc/stdlib/rand48.3 +++ b/lib/libc/stdlib/rand48.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: rand48.3,v 1.4 1998/02/05 18:50:15 perry Exp $ +.\" $NetBSD: rand48.3,v 1.5 1998/04/28 21:19:49 fair Exp $ .\" .\" Copyright (c) 1993 Martin Birgmeier .\" All rights reserved. @@ -51,12 +51,13 @@ The .Fn rand48 family of functions generates pseudo-random numbers using a linear -congruential algorithm working on integers 48 bits in size. The -particular formula employed is +congruential algorithm working on integers 48 bits in size. +The particular formula employed is r(n+1) = (a * r(n) + c) mod m where the default values are for the multiplicand a = 0xfdeece66d = 25214903917 and -the addend c = 0xb = 11. The modulus is always fixed at m = 2 ** 48. +the addend c = 0xb = 11. +The modulus is always fixed at m = 2 ** 48. r(n) is called the seed of the random number generator. .Pp For all the six generator routines described next, the first @@ -65,30 +66,30 @@ computational step is to perform a single iteration of the algorithm. .Fn drand48 and .Fn erand48 -return values of type double. The full 48 bits of r(n+1) are -loaded into the mantissa of the returned value, with the exponent set -such that the values produced lie in the interval [0.0, 1.0). +return values of type double. +The full 48 bits of r(n+1) are loaded into the mantissa of the +returned value, with the exponent set such that the values produced +lie in the interval [0.0, 1.0). .Pp .Fn lrand48 and .Fn nrand48 -return values of type long in the range -[0, 2**31-1]. The high-order (31) bits of -r(n+1) are loaded into the lower bits of the returned value, with -the topmost (sign) bit set to zero. +return values of type long in the range [0, 2**31-1]. +The high-order (31) bits of r(n+1) are loaded into the lower bits +of the returned value, with the topmost (sign) bit set to zero. .Pp .Fn mrand48 and .Fn jrand48 -return values of type long in the range -[-2**31, 2**31-1]. The high-order (32) bits of -r(n+1) are loaded into the returned value. +return values of type long in the range [-2**31, 2**31-1]. +The high-order (32) bits of r(n+1) are loaded into the returned value. .Pp .Fn drand48 , .Fn lrand48 , and .Fn mrand48 -use an internal buffer to store r(n). For these functions +use an internal buffer to store r(n). +For these functions the initial value of r(0) = 0x1234abcd330e = 20017429951246. .Pp On the other hand, @@ -96,9 +97,9 @@ On the other hand, .Fn nrand48 , and .Fn jrand48 -use a user-supplied buffer to store the seed r(n), -which consists of an array of 3 shorts, where the zeroth member -holds the least significant bits. +use a user-supplied buffer to store the seed r(n), which consists +of an array of 3 shorts, where the zeroth member holds the least +significant bits. .Pp All functions share the same multiplicand and addend. .Pp @@ -120,8 +121,8 @@ also initializes the internal buffer r(n) of and .Fn mrand48 , but here all 48 bits of the seed can be specified in an array of 3 shorts, -where the zeroth member specifies the lowest bits. Again, -the constant multiplicand and addend of the algorithm are +where the zeroth member specifies the lowest bits. +Again, the constant multiplicand and addend of the algorithm are reset to the default values given above. .Fn seed48 returns a pointer to an array of 3 shorts which contains the old seed. |
