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.6 (Berkeley) 06/24/91"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 #include <sys/types.h> 13 #include <stdlib.h> 14 15 static u_long next = 1; 16 17 int 18 rand() 19 { 20 return ((next = next * 1103515245 + 12345) % (RAND_MAX + 1)); 21 } 22 23 void 24 srand(seed) 25 u_int seed; 26 { 27 next = seed; 28 } 29