xref: /dflybsd-src/lib/libc/gen/srand48.c (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino /*
2*86d7f5d3SJohn Marino  * Copyright (c) 1993 Martin Birgmeier
3*86d7f5d3SJohn Marino  * All rights reserved.
4*86d7f5d3SJohn Marino  *
5*86d7f5d3SJohn Marino  * You may redistribute unmodified or modified versions of this source
6*86d7f5d3SJohn Marino  * code provided that the above copyright notice and this and the
7*86d7f5d3SJohn Marino  * following conditions are retained.
8*86d7f5d3SJohn Marino  *
9*86d7f5d3SJohn Marino  * This software is provided ``as is'', and comes with no warranties
10*86d7f5d3SJohn Marino  * of any kind. I shall in no event be liable for anything that happens
11*86d7f5d3SJohn Marino  * to anyone/anything when using this software.
12*86d7f5d3SJohn Marino  */
13*86d7f5d3SJohn Marino 
14*86d7f5d3SJohn Marino #include "rand48.h"
15*86d7f5d3SJohn Marino 
16*86d7f5d3SJohn Marino extern unsigned short _rand48_seed[3];
17*86d7f5d3SJohn Marino extern unsigned short _rand48_mult[3];
18*86d7f5d3SJohn Marino extern unsigned short _rand48_add;
19*86d7f5d3SJohn Marino 
20*86d7f5d3SJohn Marino void
srand48(long seed)21*86d7f5d3SJohn Marino srand48(long seed)
22*86d7f5d3SJohn Marino {
23*86d7f5d3SJohn Marino 	_rand48_seed[0] = RAND48_SEED_0;
24*86d7f5d3SJohn Marino 	_rand48_seed[1] = (unsigned short) seed;
25*86d7f5d3SJohn Marino 	_rand48_seed[2] = (unsigned short) (seed >> 16);
26*86d7f5d3SJohn Marino 	_rand48_mult[0] = RAND48_MULT_0;
27*86d7f5d3SJohn Marino 	_rand48_mult[1] = RAND48_MULT_1;
28*86d7f5d3SJohn Marino 	_rand48_mult[2] = RAND48_MULT_2;
29*86d7f5d3SJohn Marino 	_rand48_add = RAND48_ADD;
30*86d7f5d3SJohn Marino }
31