xref: /original-bsd/lib/libc/stdlib/rand.3 (revision ba762ddc)
1.\" Copyright (c) 1990, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)rand.3	6.6 (Berkeley) 04/19/91
7.\"
8.Dd
9.Dt RAND 3
10.Os
11.Sh NAME
12.Nm rand ,
13.Nm srand
14.Nd bad random number generator
15.Sh SYNOPSIS
16.Fd #include <stdlib.h>
17.Ft void
18.Fn srand "unsigned seed"
19.Ft int
20.Fn rand void
21.Sh DESCRIPTION
22.Bf -symbolic
23These interfaces are obsoleted by random(3).
24.Ef
25.Pp
26The
27.Fn rand
28function computes a sequence of pseudo-random integers in the range
29of 0 to
30.Dv RAND_MAX
31(as defined by the header file
32.Aq Pa stdlib.h ) .
33.Pp
34The
35.Fn srand
36function sets its argument as the seed for a new sequence of
37pseudo-random numbers to be returned by
38.Fn rand .
39These sequences are repeatable by calling
40.Fn srand
41with the same seed value.
42.Pp
43If no seed value is provided, the functions are automatically
44seeded with a value of 1.
45.Sh SEE ALSO
46.Xr random 3
47.Sh STANDARDS
48The
49.Fn rand
50and
51.Fn srand
52functions
53conform to
54.St -ansiC .
55