erand48.c revision 3016
13016Swollman/*
23016Swollman * Copyright (c) 1993 Martin Birgmeier
33016Swollman * All rights reserved.
43016Swollman *
53016Swollman * You may redistribute unmodified or modified versions of this source
63016Swollman * code provided that the above copyright notice and this and the
73016Swollman * following conditions are retained.
83016Swollman *
93016Swollman * This software is provided ``as is'', and comes with no warranties
103016Swollman * of any kind. I shall in no event be liable for anything that happens
113016Swollman * to anyone/anything when using this software.
123016Swollman */
133016Swollman
143016Swollman#include "rand48.h"
153016Swollman
163016Swollmandouble
173016Swollmanerand48(unsigned short xseed[3])
183016Swollman{
193016Swollman	_dorand48(xseed);
203016Swollman	return ldexp((double) xseed[0], -48) +
213016Swollman	       ldexp((double) xseed[1], -32) +
223016Swollman	       ldexp((double) xseed[2], -16);
233016Swollman}
24