my previous version was wrong; this one is right
[unix-history] / usr / src / lib / libc / stdlib / rand.3
CommitLineData
0632022a
KB
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
fc9e796e 3.\"
0632022a
KB
4.\" %sccs.include.redist.man%
5.\"
6.\" @(#)rand.3 6.5 (Berkeley) %G%
7.\"
8.TH RAND 3 ""
fc9e796e
KM
9.AT 3
10.SH NAME
0632022a 11rand, srand \- bad random number generator
fc9e796e
KM
12.SH SYNOPSIS
13.nf
0632022a
KB
14.ft B
15void
16srand(seed)
17unsigned int seed;
18
19rand()
fc9e796e
KM
20.fi
21.SH DESCRIPTION
c9573fe5 22.ft B
c140d685 23These interfaces are obsoleted by random(3).
c9573fe5
KM
24.ft R
25.PP
0632022a
KB
26The
27.I rand
28function computes a sequence of pseudo-random integers in the range
29of 0 to
30.I RAND_MAX
31(as defined by the header file <stdlib.h>).
fc9e796e 32.PP
0632022a 33The
fc9e796e 34.I srand
0632022a
KB
35function sets its argument as the seed for a new sequence of
36pseudo-random numbers to be returned by
37.IR rand .
38These sequences are repeatable by calling
fc9e796e 39.I srand
0632022a
KB
40with the same seed value.
41.PP
42If no seed value is provided, the functions are automatically
43seeded with a value of 1.
44.SH STANDARDS
45.B Rand
46and
47.B srand
48conform to ANSI X3.159-1989 (``ANSI C'').
c9573fe5
KM
49.SH "SEE ALSO"
50random(3)