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