Rev | Line | |
---|
[9] | 1 | .\" @(#)rand.3c 6.2 (Berkeley) 9/29/85
|
---|
| 2 | .\"
|
---|
| 3 | .TH RAND 3 "September 29, 1985"
|
---|
| 4 | .AT 3
|
---|
| 5 | .SH NAME
|
---|
| 6 | rand, srand \- random number generator
|
---|
| 7 | .SH SYNOPSIS
|
---|
| 8 | .nf
|
---|
| 9 | .ft B
|
---|
| 10 | #include <stdlib.h>
|
---|
| 11 |
|
---|
| 12 | void srand(unsigned \fIseed\fP)
|
---|
| 13 | unsigned rand(void)
|
---|
| 14 | .ft R
|
---|
| 15 | .fi
|
---|
| 16 | .SH DESCRIPTION
|
---|
| 17 | .B Rand
|
---|
| 18 | uses a multiplicative congruential
|
---|
| 19 | random number generator with period
|
---|
| 20 | .if t 2\u\s732\s0\d
|
---|
| 21 | .if n 2**32
|
---|
| 22 | to return successive pseudo-random
|
---|
| 23 | numbers in the range from 0 to
|
---|
| 24 | .BR RAND_MAX .
|
---|
| 25 | .PP
|
---|
| 26 | The generator is reinitialized by calling
|
---|
| 27 | .B srand
|
---|
| 28 | with 1 as argument.
|
---|
| 29 | It can be set to a random starting point by calling
|
---|
| 30 | .B srand
|
---|
| 31 | with whatever you like as argument.
|
---|
| 32 | .SH "SEE ALSO"
|
---|
| 33 | .BR random (3).
|
---|
Note:
See
TracBrowser
for help on using the repository browser.