|
|
1.1 root 1: .\" @(#)rand.3c 6.2 (Berkeley) 9/29/85
2: .\"
3: .TH RAND 3C "September 29, 1985"
4: .AT 3
5: .SH NAME
6: rand, srand \- random number generator
7: .SH SYNOPSIS
8: .nf
9: .B srand(seed)
10: .B int seed;
11: .PP
12: .B rand()
13: .fi
14: .SH DESCRIPTION
15: .ft B
16: The newer random(3) should be used in new applications;
17: rand remains for compatibilty.
18: .ft R
19: .PP
20: .I Rand
21: uses a multiplicative congruential
22: random number generator with period
23: .if t 2\u\s732\s0\d
24: .if n 2**32
25: to return successive pseudo-random
26: numbers in the range from 0 to
27: .if t 2\u\s731\s10\d\(mi1.
28: .if n (2**31)\(mi1
29: .PP
30: The generator is reinitialized by calling
31: .I srand
32: with 1 as argument.
33: It can be set to a random starting point by calling
34: .I srand
35: with whatever you like as argument.
36: .SH "SEE ALSO"
37: random(3)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.