xref: /csrg-svn/lib/libc/stdlib/rand.c (revision 63435)
142089Sbostic /*-
2*63435Sbostic  * Copyright (c) 1990, 1993
3*63435Sbostic  *	The Regents of the University of California.  All rights reserved.
442089Sbostic  *
542089Sbostic  * %sccs.include.redist.c%
621331Sdist  */
721331Sdist 
826519Sdonn #if defined(LIBC_SCCS) && !defined(lint)
9*63435Sbostic static char sccsid[] = "@(#)rand.c	8.1 (Berkeley) 06/14/93";
1042089Sbostic #endif /* LIBC_SCCS and not lint */
1121331Sdist 
1242089Sbostic #include <sys/types.h>
1342089Sbostic #include <stdlib.h>
141976Swnj 
1542089Sbostic static u_long next = 1;
1642089Sbostic 
1742089Sbostic int
rand()1842089Sbostic rand()
191976Swnj {
2063434Sbostic 	return ((next = next * 1103515245 + 12345) % ((u_long)RAND_MAX + 1));
211976Swnj }
221976Swnj 
2342089Sbostic void
srand(seed)2442089Sbostic srand(seed)
2542089Sbostic u_int seed;
261976Swnj {
2742089Sbostic 	next = seed;
281976Swnj }
29