1*84d9c625SLionel Sambuc /* $NetBSD: jrand48.c,v 1.9 2013/10/22 08:08:51 matt Exp $ */ 22fe8fb19SBen Gras 32fe8fb19SBen Gras /* 42fe8fb19SBen Gras * Copyright (c) 1993 Martin Birgmeier 52fe8fb19SBen Gras * All rights reserved. 62fe8fb19SBen Gras * 72fe8fb19SBen Gras * You may redistribute unmodified or modified versions of this source 82fe8fb19SBen Gras * code provided that the above copyright notice and this and the 92fe8fb19SBen Gras * following conditions are retained. 102fe8fb19SBen Gras * 112fe8fb19SBen Gras * This software is provided ``as is'', and comes with no warranties 122fe8fb19SBen Gras * of any kind. I shall in no event be liable for anything that happens 132fe8fb19SBen Gras * to anyone/anything when using this software. 142fe8fb19SBen Gras */ 152fe8fb19SBen Gras 162fe8fb19SBen Gras #include <sys/cdefs.h> 172fe8fb19SBen Gras #if defined(LIBC_SCCS) && !defined(lint) 18*84d9c625SLionel Sambuc __RCSID("$NetBSD: jrand48.c,v 1.9 2013/10/22 08:08:51 matt Exp $"); 192fe8fb19SBen Gras #endif /* LIBC_SCCS and not lint */ 202fe8fb19SBen Gras 212fe8fb19SBen Gras #include "namespace.h" 222fe8fb19SBen Gras 232fe8fb19SBen Gras #include <assert.h> 242fe8fb19SBen Gras 252fe8fb19SBen Gras #include "rand48.h" 262fe8fb19SBen Gras 272fe8fb19SBen Gras #ifdef __weak_alias __weak_alias(jrand48,_jrand48)282fe8fb19SBen Gras__weak_alias(jrand48,_jrand48) 292fe8fb19SBen Gras #endif 302fe8fb19SBen Gras 312fe8fb19SBen Gras long 322fe8fb19SBen Gras jrand48(unsigned short xseed[3]) 332fe8fb19SBen Gras { 342fe8fb19SBen Gras 352fe8fb19SBen Gras _DIAGASSERT(xseed != NULL); 362fe8fb19SBen Gras 372fe8fb19SBen Gras __dorand48(xseed); 38*84d9c625SLionel Sambuc return (int16_t)xseed[2] * 65536 + xseed[1]; 392fe8fb19SBen Gras } 40