xref: /csrg-svn/lib/libc/stdlib/rand.c (revision 42089)
1 /*-
2  * Copyright (c) 1990 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)rand.c	5.3 (Berkeley) 05/15/90";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #include <sys/types.h>
13 #include <sys/stdc.h>
14 #include <stdlib.h>
15 
16 static u_long next = 1;
17 
18 int
19 rand()
20 {
21 	return ((next = next * 1103515245 + 12345) % RAND_MAX);
22 }
23 
24 void
25 srand(seed)
26 u_int seed;
27 {
28 	next = seed;
29 }
30