1 /* $NetBSD: seed48.c,v 1.7 2000/01/22 22:19:20 mycroft Exp $ */ 2 3 /* 4 * Copyright (c) 1993 Martin Birgmeier 5 * All rights reserved. 6 * 7 * You may redistribute unmodified or modified versions of this source 8 * code provided that the above copyright notice and this and the 9 * following conditions are retained. 10 * 11 * This software is provided ``as is'', and comes with no warranties 12 * of any kind. I shall in no event be liable for anything that happens 13 * to anyone/anything when using this software. 14 */ 15 16 #include "namespace.h" 17 18 #include <assert.h> 19 20 #include "rand48.h" 21 22 #ifdef __weak_alias 23 __weak_alias(seed48,_seed48) 24 #endif 25 26 unsigned short * 27 seed48(unsigned short xseed[3]) 28 { 29 static unsigned short sseed[3]; 30 31 _DIAGASSERT(xseed != NULL); 32 33 sseed[0] = __rand48_seed[0]; 34 sseed[1] = __rand48_seed[1]; 35 sseed[2] = __rand48_seed[2]; 36 __rand48_seed[0] = xseed[0]; 37 __rand48_seed[1] = xseed[1]; 38 __rand48_seed[2] = xseed[2]; 39 __rand48_mult[0] = RAND48_MULT_0; 40 __rand48_mult[1] = RAND48_MULT_1; 41 __rand48_mult[2] = RAND48_MULT_2; 42 __rand48_add = RAND48_ADD; 43 return sseed; 44 } 45