1/*-
2 * Copyright (c) 1980 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.proprietary.c%
6 */
7
8#ifndef lint
9static char sccsid[] = "@(#)rand_.c.other	5.2 (Berkeley) 04/12/91";
10#endif /* not lint */
11
12/*
13Uniform random number generator.  Code courtesy of Bob Morris.
14Linear congruential generator, suitable for 32 bit machines;
15multiplication is mod 2**31
16*/
17
18static	long	randx = 1;
19
20srand_(x)	/* subroutine to set seed */
21long *x;
22{
23randx = *x;
24}
25
26
27
28
29double rand_()
30{
31double ldexp();
32return(ldexp((double)(((randx = randx*1103515245 + 12345)>>7) & 077777777), -24));
33}
34