drand48.c\prng\src - musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/prng/drand48.c
blob: 08283e240b14fad45921469bc7aea39eadda3670 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#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);
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月23日 10:31:01 +0000

AltStyle によって変換されたページ (->オリジナル) /