File:  [CSRG BSD Unix] / 43BSDTahoe / man / man3f / rand.3
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)rand.3f	6.1 (Berkeley) 5/15/85
.\"
.TH RAND 3F "May 15, 1985"
.UC 5
.SH NAME
rand, drand, irand \- return random values
.SH SYNOPSIS
.B function irand (iflag)
.sp 1
.B function rand (iflag)
.sp 1
.B double precision function drand (iflag)
.SH DESCRIPTION
.ft B
The newer random(3f) should be used in new applications;
rand remains for compatibilty.
.ft R
.PP
These functions use
.IR rand (3C)
to generate sequences of random numbers.
If
.I iflag
is '1', the generator is restarted and the first random value is returned.
If
.I iflag
is otherwise non-zero, it is used as a new seed for the random number
generator, and the first new random value is returned.
.PP
.I Irand
returns positive integers in the range 0 through 2147483647.
.I Rand
and
.I drand
return values in the range 0. through 1.0 .
.SH FILES
.ie \nM /usr/ucb/lib/libF77.a
.el /usr/lib/libF77.a
.SH "SEE ALSO"
random(3F), rand(3C)
.SH BUGS
The algorithm returns a 15 bit quantity on the PDP11; a 31 bit quantity
on the VAX.
.I Irand
on the PDP11 calls
.IR rand (3C)
twice to form a 31 bit quantity, but bit 15 will always be 0.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.