Commit | Line | Data |
---|---|---|
9fcc6ccb KM |
1 | .\" Copyright (c) 1983 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
63d908a2 | 5 | .\" @(#)rand.3 6.1 (Berkeley) %G% |
9fcc6ccb | 6 | .\" |
63d908a2 | 7 | .TH RAND 3F "" |
9fcc6ccb KM |
8 | .UC 5 |
9 | .SH NAME | |
10 | rand, drand, irand \- return random values | |
11 | .SH SYNOPSIS | |
12 | .B function irand (iflag) | |
13 | .sp 1 | |
14 | .B function rand (iflag) | |
15 | .sp 1 | |
16 | .B double precision function drand (iflag) | |
17 | .SH DESCRIPTION | |
63d908a2 KM |
18 | .ft B |
19 | The newer random(3f) should be used in new applications; | |
20 | rand remains for compatibilty. | |
21 | .ft R | |
22 | .PP | |
9fcc6ccb KM |
23 | These functions use |
24 | .IR rand (3C) | |
25 | to generate sequences of random numbers. | |
26 | If | |
27 | .I iflag | |
28 | is '1', the generator is restarted and the first random value is returned. | |
29 | If | |
30 | .I iflag | |
31 | is otherwise non-zero, it is used as a new seed for the random number | |
32 | generator, and the first new random value is returned. | |
33 | .PP | |
34 | .I Irand | |
35 | returns positive integers in the range 0 through 2147483647. | |
36 | .I Rand | |
37 | and | |
38 | .I drand | |
39 | return values in the range 0. through 1.0 . | |
40 | .SH FILES | |
41 | .ie \nM /usr/ucb/lib/libF77.a | |
42 | .el /usr/lib/libF77.a | |
43 | .SH "SEE ALSO" | |
63d908a2 | 44 | random(3F), rand(3C) |
9fcc6ccb KM |
45 | .SH BUGS |
46 | The algorithm returns a 15 bit quantity on the PDP11; a 31 bit quantity | |
47 | on the VAX. | |
48 | .I Irand | |
49 | on the PDP11 calls | |
50 | .IR rand (3C) | |
51 | twice to form a 31 bit quantity, but bit 15 will always be 0. |