aboutsummaryrefslogtreecommitdiff
path: root/src/prng/drand48.c
blob: 13b928da05f999a5ebf3bfe28ccb00368e271712 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdlib.h>
#include <inttypes.h>
#include "rand48.h"

double erand48(unsigned short s[3])
{
	union {
		uint64_t u;
		double f;
	} x = { 0x3ff0000000000000ULL | __rand48_step(s, __seed48+3)<<4 };
	return x.f - 1.0;
}

double drand48(void)
{
	return erand48(__seed48);
}


#ifdef TEST
int
main(void) {
	return 0;
}
#endif