xref: /dflybsd-src/lib/libc/gen/seed48.c (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /*
286d7f5d3SJohn Marino  * Copyright (c) 1993 Martin Birgmeier
386d7f5d3SJohn Marino  * All rights reserved.
486d7f5d3SJohn Marino  *
586d7f5d3SJohn Marino  * You may redistribute unmodified or modified versions of this source
686d7f5d3SJohn Marino  * code provided that the above copyright notice and this and the
786d7f5d3SJohn Marino  * following conditions are retained.
886d7f5d3SJohn Marino  *
986d7f5d3SJohn Marino  * This software is provided ``as is'', and comes with no warranties
1086d7f5d3SJohn Marino  * of any kind. I shall in no event be liable for anything that happens
1186d7f5d3SJohn Marino  * to anyone/anything when using this software.
1286d7f5d3SJohn Marino  */
1386d7f5d3SJohn Marino 
1486d7f5d3SJohn Marino #include "rand48.h"
1586d7f5d3SJohn Marino 
1686d7f5d3SJohn Marino extern unsigned short _rand48_seed[3];
1786d7f5d3SJohn Marino extern unsigned short _rand48_mult[3];
1886d7f5d3SJohn Marino extern unsigned short _rand48_add;
1986d7f5d3SJohn Marino 
2086d7f5d3SJohn Marino unsigned short *
seed48(unsigned short xseed[3])2186d7f5d3SJohn Marino seed48(unsigned short xseed[3])
2286d7f5d3SJohn Marino {
2386d7f5d3SJohn Marino 	static unsigned short sseed[3];
2486d7f5d3SJohn Marino 
2586d7f5d3SJohn Marino 	sseed[0] = _rand48_seed[0];
2686d7f5d3SJohn Marino 	sseed[1] = _rand48_seed[1];
2786d7f5d3SJohn Marino 	sseed[2] = _rand48_seed[2];
2886d7f5d3SJohn Marino 	_rand48_seed[0] = xseed[0];
2986d7f5d3SJohn Marino 	_rand48_seed[1] = xseed[1];
3086d7f5d3SJohn Marino 	_rand48_seed[2] = xseed[2];
3186d7f5d3SJohn Marino 	_rand48_mult[0] = RAND48_MULT_0;
3286d7f5d3SJohn Marino 	_rand48_mult[1] = RAND48_MULT_1;
3386d7f5d3SJohn Marino 	_rand48_mult[2] = RAND48_MULT_2;
3486d7f5d3SJohn Marino 	_rand48_add = RAND48_ADD;
3586d7f5d3SJohn Marino 	return sseed;
3686d7f5d3SJohn Marino }
37