148350Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California. 242090Sbostic.\" All rights reserved. 320445Smckusick.\" 4*50317Sbostic.\" This code is derived from software contributed to Berkeley by 5*50317Sbostic.\" the American National Standards Committee X3, on Information 6*50317Sbostic.\" Processing Systems. 7*50317Sbostic.\" 842090Sbostic.\" %sccs.include.redist.man% 942090Sbostic.\" 10*50317Sbostic.\" @(#)rand.3 6.7 (Berkeley) 06/29/91 1142090Sbostic.\" 1248350Scael.Dd 1348350Scael.Dt RAND 3 1448350Scael.Os 1548350Scael.Sh NAME 1648350Scael.Nm rand , 1748350Scael.Nm srand 1848350Scael.Nd bad random number generator 1948350Scael.Sh SYNOPSIS 2048350Scael.Fd #include <stdlib.h> 2148350Scael.Ft void 2248350Scael.Fn srand "unsigned seed" 2348350Scael.Ft int 2448350Scael.Fn rand void 2548350Scael.Sh DESCRIPTION 2648350Scael.Bf -symbolic 2738039SbosticThese interfaces are obsoleted by random(3). 2848350Scael.Ef 2948350Scael.Pp 3042090SbosticThe 3148350Scael.Fn rand 3242090Sbosticfunction computes a sequence of pseudo-random integers in the range 3342090Sbosticof 0 to 3448350Scael.Dv RAND_MAX 3548350Scael(as defined by the header file 3648350Scael.Aq Pa stdlib.h ) . 3748350Scael.Pp 3842090SbosticThe 3948350Scael.Fn srand 4042090Sbosticfunction sets its argument as the seed for a new sequence of 4142090Sbosticpseudo-random numbers to be returned by 4248350Scael.Fn rand . 4342090SbosticThese sequences are repeatable by calling 4448350Scael.Fn srand 4542090Sbosticwith the same seed value. 4648350Scael.Pp 4742090SbosticIf no seed value is provided, the functions are automatically 4842090Sbosticseeded with a value of 1. 4948350Scael.Sh SEE ALSO 5048350Scael.Xr random 3 5148350Scael.Sh STANDARDS 5248350ScaelThe 5348350Scael.Fn rand 5442090Sbosticand 5548350Scael.Fn srand 5648350Scaelfunctions 5748350Scaelconform to 5848350Scael.St -ansiC . 59