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