1*e90fdadcSguenther /* $OpenBSD: lrand48.c,v 1.5 2015/08/27 04:33:31 guenther Exp $ */ 2df930be7Sderaadt /* 3df930be7Sderaadt * Copyright (c) 1993 Martin Birgmeier 4df930be7Sderaadt * All rights reserved. 5df930be7Sderaadt * 6df930be7Sderaadt * You may redistribute unmodified or modified versions of this source 7df930be7Sderaadt * code provided that the above copyright notice and this and the 8df930be7Sderaadt * following conditions are retained. 9df930be7Sderaadt * 10df930be7Sderaadt * This software is provided ``as is'', and comes with no warranties 11df930be7Sderaadt * of any kind. I shall in no event be liable for anything that happens 12df930be7Sderaadt * to anyone/anything when using this software. 13df930be7Sderaadt */ 14df930be7Sderaadt 15df930be7Sderaadt #include "rand48.h" 16df930be7Sderaadt 17df930be7Sderaadt long lrand48(void)18df930be7Sderaadtlrand48(void) 19df930be7Sderaadt { 20f7510a6eSderaadt if (__rand48_deterministic == 0) 21f7510a6eSderaadt return arc4random() & 0x7fffffff; 22df930be7Sderaadt __dorand48(__rand48_seed); 23df930be7Sderaadt return ((long) __rand48_seed[2] << 15) + ((long) __rand48_seed[1] >> 1); 24df930be7Sderaadt } 25