updates
[unix-history] / usr / src / share / man / man3f / rand.3
CommitLineData
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
10rand, 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
19The newer random(3f) should be used in new applications;
20rand remains for compatibilty.
21.ft R
22.PP
9fcc6ccb
KM
23These functions use
24.IR rand (3C)
25to generate sequences of random numbers.
26If
27.I iflag
28is '1', the generator is restarted and the first random value is returned.
29If
30.I iflag
31is otherwise non-zero, it is used as a new seed for the random number
32generator, and the first new random value is returned.
33.PP
34.I Irand
35returns positive integers in the range 0 through 2147483647.
36.I Rand
37and
38.I drand
39return 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 44random(3F), rand(3C)
9fcc6ccb
KM
45.SH BUGS
46The algorithm returns a 15 bit quantity on the PDP11; a 31 bit quantity
47on the VAX.
48.I Irand
49on the PDP11 calls
50.IR rand (3C)
51twice to form a 31 bit quantity, but bit 15 will always be 0.