Research V4 development
authorKen Thompson <ken@research.uucp>
Sun, 18 Nov 1973 19:47:40 +0000 (14:47 -0500)
committerKen Thompson <ken@research.uucp>
Sun, 18 Nov 1973 19:47:40 +0000 (14:47 -0500)
Work on file man/man3/rand.3

Co-Authored-By: Dennis Ritchie <dmr@research.uucp>
Synthesized-from: v4

man/man3/rand.3 [new file with mode: 0644]

diff --git a/man/man3/rand.3 b/man/man3/rand.3
new file mode 100644 (file)
index 0000000..92bac81
--- /dev/null
@@ -0,0 +1,39 @@
+.th RAND III 1/15/73
+.sh NAME
+rand \*- random number generator
+.sh SYNOPSIS
+(seed in r0)
+.br
+.ft B
+jsr    pc,srand        /to initialize
+.s3
+jsr pc,rand    /to get a random number
+.s3
+.nf
+srand(seed)
+int seed;
+.s3
+rand( )
+.fi
+.ft R
+.s3
+.sh DESCRIPTION
+.it Rand
+uses a multiplicative congruential
+random number generator to return successive pseudo-random
+numbers (in r0) in the range from 1 to 2\u\s715\s10\d\*-1.
+.s3
+The generator is reinitialized by calling
+.it srand
+with 1 as argument (in r0).
+It can be set to a random starting point by calling
+.it srand
+with whatever you like as argument,
+for example the low-order word
+of the time.
+.sh WARNING
+The author of this routine has been writing
+random-number generators for many years and has never been
+known to write one that worked.
+.sh BUGS
+The low-order bits are not very random.