xref: /csrg-svn/lib/libc/stdlib/rand.c (revision 26519)
121331Sdist /*
221331Sdist  * Copyright (c) 1980 Regents of the University of California.
321331Sdist  * All rights reserved.  The Berkeley software License Agreement
421331Sdist  * specifies the terms and conditions for redistribution.
521331Sdist  */
621331Sdist 
7*26519Sdonn #if defined(LIBC_SCCS) && !defined(lint)
8*26519Sdonn static char sccsid[] = "@(#)rand.c	5.2 (Berkeley) 03/09/86";
9*26519Sdonn #endif LIBC_SCCS and not lint
1021331Sdist 
111976Swnj static	long	randx = 1;
121976Swnj 
131976Swnj srand(x)
141976Swnj unsigned x;
151976Swnj {
161976Swnj 	randx = x;
171976Swnj }
181976Swnj 
191976Swnj rand()
201976Swnj {
211976Swnj 	return((randx = randx * 1103515245 + 12345) & 0x7fffffff);
221976Swnj }
23