-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
The wyhash repo (which rapidhash evolved from) provides wyrand, wy2u01, and wy2gau functions for generating random numbers. The code for these functions is shown below. What are the equivalent functions for rapidhash?
// The wyrand PRNG that pass BigCrush and PractRand
static inline uint64_t wyrand(uint64_t *seed) {
*seed += 0x2d358dccaa6c78a5ull;
return _wymix(*seed, *seed ^ 0x8bb84b93962eacc9ull);
}
// Convert any 64 bit pseudo random numbers to uniform distribution [0,1). It can be combined with
// wyrand, wyhash64 or wyhash.
static inline double wy2u01(uint64_t r) {
const double _wynorm = 1.0 / (1ull << 52);
return (r >> 12) * _wynorm;
}
// Convert any 64 bit pseudo random numbers to APPROXIMATE Gaussian distribution. It can be combined
// with wyrand, wyhash64 or wyhash.
static inline double wy2gau(uint64_t r) {
const double _wynorm = 1.0 / (1ull << 20);
return ((r &0x1fffff) + ((r >> 21) &0x1fffff) + ((r >> 42) &0x1fffff)) * _wynorm - 3.0;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels