[*] Revert fast rng ABI. Messing with the entropy doesn't make much sense considering the perf tradeoff

This commit is contained in:
Reece Wilson 2022-04-11 20:28:18 +01:00
parent 2de033a575
commit 9fe22062f8

View File

@ -28,24 +28,11 @@ static auline void WELL_SeedRand64(WELLRand *rand, AuUInt64 seed)
AuMemset(rand->state, 0, sizeof(rand->state));
// Let's mess with the entropy in case there is an attempt to reverse the base seed from
// iterations of the WELL_NextLong_Unlocked function. Variance between mtrand and mtrand2
// increases with each iteration up to a hopefully unknown value
AuUInt8 confuser = (MT_NextLong(&mtrand2) & 0xFF) / 5 + 5;
for (int z = 0; z < confuser; z++)
{
for (int i = 0; i < z; i++)
{
MT_NextLong(&mtrand);
}
for (unsigned int i = 0; i < AuArraySize(rand->state); i++)
{
rand->state[i] = MT_NextLong(&mtrand) ^ MT_NextLong(&mtrand2);
}
}
}
static auline void WELL_SeedRand(WELLRand *rand, AuUInt32 seed)
{
@ -53,21 +40,11 @@ static auline void WELL_SeedRand(WELLRand *rand, AuUInt32 seed)
AuMemset(rand->state, 0, sizeof(rand->state));
AuUInt8 confuser = (MT_NextLong(&mtrand) & 0xFF) / 5 + 5;
for (int z = 0; z < confuser; z++)
{
for (int i = 0; i < z; i++)
{
MT_NextLong(&mtrand);
}
for (unsigned int i = 0; i < AuArraySize(rand->state); i++)
{
rand->state[i] = MT_NextLong(&mtrand);
}
}
}
/**
* Creates a new random number generator from a given seed.