xref: /csrg-svn/lib/libc/stdlib/rand.3 (revision 48350)
1*48350Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California.
242090Sbostic.\" All rights reserved.
320445Smckusick.\"
442090Sbostic.\" %sccs.include.redist.man%
542090Sbostic.\"
6*48350Scael.\"     @(#)rand.3	6.6 (Berkeley) 04/19/91
742090Sbostic.\"
8*48350Scael.Dd
9*48350Scael.Dt RAND 3
10*48350Scael.Os
11*48350Scael.Sh NAME
12*48350Scael.Nm rand ,
13*48350Scael.Nm srand
14*48350Scael.Nd bad random number generator
15*48350Scael.Sh SYNOPSIS
16*48350Scael.Fd #include <stdlib.h>
17*48350Scael.Ft void
18*48350Scael.Fn srand "unsigned seed"
19*48350Scael.Ft int
20*48350Scael.Fn rand void
21*48350Scael.Sh DESCRIPTION
22*48350Scael.Bf -symbolic
2338039SbosticThese interfaces are obsoleted by random(3).
24*48350Scael.Ef
25*48350Scael.Pp
2642090SbosticThe
27*48350Scael.Fn rand
2842090Sbosticfunction computes a sequence of pseudo-random integers in the range
2942090Sbosticof 0 to
30*48350Scael.Dv RAND_MAX
31*48350Scael(as defined by the header file
32*48350Scael.Aq Pa stdlib.h ) .
33*48350Scael.Pp
3442090SbosticThe
35*48350Scael.Fn srand
3642090Sbosticfunction sets its argument as the seed for a new sequence of
3742090Sbosticpseudo-random numbers to be returned by
38*48350Scael.Fn rand .
3942090SbosticThese sequences are repeatable by calling
40*48350Scael.Fn srand
4142090Sbosticwith the same seed value.
42*48350Scael.Pp
4342090SbosticIf no seed value is provided, the functions are automatically
4442090Sbosticseeded with a value of 1.
45*48350Scael.Sh SEE ALSO
46*48350Scael.Xr random 3
47*48350Scael.Sh STANDARDS
48*48350ScaelThe
49*48350Scael.Fn rand
5042090Sbosticand
51*48350Scael.Fn srand
52*48350Scaelfunctions
53*48350Scaelconform to
54*48350Scael.St -ansiC .
55