lrand48.c revision 1.8
11.8Slukem/*	$NetBSD: lrand48.c,v 1.8 2005/06/12 05:21:28 lukem Exp $	*/
21.5Sperry
31.1Sbrezak/*
41.1Sbrezak * Copyright (c) 1993 Martin Birgmeier
51.1Sbrezak * All rights reserved.
61.1Sbrezak *
71.1Sbrezak * You may redistribute unmodified or modified versions of this source
81.1Sbrezak * code provided that the above copyright notice and this and the
91.1Sbrezak * following conditions are retained.
101.1Sbrezak *
111.1Sbrezak * This software is provided ``as is'', and comes with no warranties
121.1Sbrezak * of any kind. I shall in no event be liable for anything that happens
131.1Sbrezak * to anyone/anything when using this software.
141.1Sbrezak */
151.1Sbrezak
161.8Slukem#include <sys/cdefs.h>
171.8Slukem#if defined(LIBC_SCCS) && !defined(lint)
181.8Slukem__RCSID("$NetBSD: lrand48.c,v 1.8 2005/06/12 05:21:28 lukem Exp $");
191.8Slukem#endif /* LIBC_SCCS and not lint */
201.8Slukem
211.4Sjtc#include "namespace.h"
221.1Sbrezak#include "rand48.h"
231.1Sbrezak
241.4Sjtc#ifdef __weak_alias
251.7Smycroft__weak_alias(lrand48,_lrand48)
261.4Sjtc#endif
271.1Sbrezak
281.1Sbrezaklong
291.1Sbrezaklrand48(void)
301.1Sbrezak{
311.3Sjtc	__dorand48(__rand48_seed);
321.6Schristos	return (long)((unsigned long) __rand48_seed[2] << 15) +
331.6Schristos	    ((unsigned long) __rand48_seed[1] >> 1);
341.1Sbrezak}
35