update from Mike Karels at BSDI
[unix-history] / usr / src / lib / libc / stdlib / rand.3
.\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the American National Standards Committee X3, on Information
.\" Processing Systems.
.\"
.\" %sccs.include.redist.man%
.\"
.\" @(#)rand.3 6.7 (Berkeley) %G%
.\"
.Dd
.Dt RAND 3
.Os
.Sh NAME
.Nm rand ,
.Nm srand
.Nd bad random number generator
.Sh SYNOPSIS
.Fd #include <stdlib.h>
.Ft void
.Fn srand "unsigned seed"
.Ft int
.Fn rand void
.Sh DESCRIPTION
.Bf -symbolic
These interfaces are obsoleted by random(3).
.Ef
.Pp
The
.Fn rand
function computes a sequence of pseudo-random integers in the range
of 0 to
.Dv RAND_MAX
(as defined by the header file
.Aq Pa stdlib.h ) .
.Pp
The
.Fn srand
function sets its argument as the seed for a new sequence of
pseudo-random numbers to be returned by
.Fn rand .
These sequences are repeatable by calling
.Fn srand
with the same seed value.
.Pp
If no seed value is provided, the functions are automatically
seeded with a value of 1.
.Sh SEE ALSO
.Xr random 3
.Sh STANDARDS
The
.Fn rand
and
.Fn srand
functions
conform to
.St -ansiC .