xref: /csrg-svn/lib/libc/stdlib/rand.c (revision 21331)
1*21331Sdist /*
2*21331Sdist  * Copyright (c) 1980 Regents of the University of California.
3*21331Sdist  * All rights reserved.  The Berkeley software License Agreement
4*21331Sdist  * specifies the terms and conditions for redistribution.
5*21331Sdist  */
6*21331Sdist 
7*21331Sdist #ifndef lint
8*21331Sdist static char sccsid[] = "@(#)rand.c	5.1 (Berkeley) 05/30/85";
9*21331Sdist #endif not lint
10*21331Sdist 
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