From 9fe22062f8de36b81af9a795c05f48d07c1b0b90 Mon Sep 17 00:00:00 2001 From: J Reece Wilson Date: Mon, 11 Apr 2022 20:28:18 +0100 Subject: [PATCH] [*] Revert fast rng ABI. Messing with the entropy doesn't make much sense considering the perf tradeoff --- Source/RNG/WELL.cpp | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/Source/RNG/WELL.cpp b/Source/RNG/WELL.cpp index 4c970c76..9fa492bf 100644 --- a/Source/RNG/WELL.cpp +++ b/Source/RNG/WELL.cpp @@ -28,22 +28,9 @@ 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 (unsigned int i = 0; i < AuArraySize(rand->state); i++) { - 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); - } + rand->state[i] = MT_NextLong(&mtrand) ^ MT_NextLong(&mtrand2); } } @@ -53,19 +40,9 @@ 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 (unsigned int i = 0; i < AuArraySize(rand->state); i++) { - 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); - } + rand->state[i] = MT_NextLong(&mtrand); } }