50 uint32_t value = (uint32_t)value_;
51 int32_t mult1 = (value & 15) + 8;
65 double superfee = 100000.0;
66 double max = 1 + precision;
67 double min = 1 - precision;
68 unsigned long long rounded_fee = superfee * floor(0.5 + fee / superfee);
69 if (rounded_fee == 0) rounded_fee = 1;
70 double ratio = fee / (double)rounded_fee;
72 while ((ratio < min || ratio > max) && superfee > 1)
74 rounded_fee = superfee * floor(0.5 + fee / superfee);
75 if (rounded_fee == 0) rounded_fee = 1;
76 ratio = fee / (double)rounded_fee;
80 if (ratio > min && ratio < max)
104 assert(ioSeed != NULL);
106 ioSeed->
high = (ioSeed->
high << 16) + (ioSeed->
high >> 16);
109 return ioSeed->
high & 0x7FFFFFFF;
132 return MakeRanrotSeed(seed.
a * 0x1000000 + seed.
b * 0x10000 + seed.
c * 0x100 + seed.
d);
158 return (
Ranrot() & 0xffff) * (1.0f / 65536.0f);
175 printf(
"***** ERROR - attempt to generate bellf(%d)\n", n);
180 total += (
Ranrot() & 1023);
181 return total / (1024.0f * n);
259 seed ^= 0xA471D52AEF3B6322ULL;
332 x = seed_ptr->
a + seed_ptr->
c + seed_ptr->
e;
333 y = seed_ptr->
b + seed_ptr->
d + seed_ptr->
f;
335 seed_ptr->
a = seed_ptr->
c;
336 seed_ptr->
b = seed_ptr->
d;
338 seed_ptr->
c = seed_ptr->
e;
339 seed_ptr->
d = seed_ptr->
f;
342 seed_ptr->
f =
y + (
x >> 8);
RANROTSeed RanrotSeedFromRandomSeed(Random_Seed seed)
const Random_Seed kNilRandomSeed
void make_pseudo_random_seed(Random_Seed *seed_ptr)
static bool sReallyRandomInited
RANROTSeed RANROTGetFullSeed(void)
void seed_RNG_only_for_planet_description(Random_Seed s_seed)
void ranrot_srand(uint32_t seed)
void OOSetReallyRandomRANROTSeed(void)
void setRandomSeed(RNG_Seed a_seed)
int16_t munge_checksum(long long value_)
uint32_t OOReallyRandom(void)
float randfWithSeed(RANROTSeed *ioSeed)
RNG_Seed currentRandomSeed(void)
void OOInitReallyRandom(uint64_t seed)
static RANROTSeed sRANROT
void OORestoreRandomState(OORandomState state)
static RANROTSeed sReallyRandomSeed
OORandomState OOSaveRandomState(void)
void RANROTSetFullSeed(RANROTSeed seed)
RANROTSeed RanrotSeedFromRNGSeed(RNG_Seed seed)
void OOSetReallyRandomRndSeed(void)
unsigned RanrotWithSeed(RANROTSeed *ioSeed)
double cunningFee(double value, double precision)
void seed_for_planet_description(Random_Seed s_seed)
RANROTSeed MakeRanrotSeed(uint32_t seed)
void OOSetReallyRandomRANROTAndRndSeeds(void)
void rotate_seed(Random_Seed *seed_ptr)