[*] Update fallback RNG entropy: reduce expected tick resolution

This commit is contained in:
Reece Wilson 2023-09-09 13:50:26 +01:00
parent cea3362186
commit cf7be329d6

View File

@ -174,7 +174,7 @@ namespace Aurora::RNG
#if 0
return clock(); // [...] resolution of 1 posix clock() tick (this is usually 1,000,000 == CLOCKS_PER_SEC per posix, but it can be 1k)
#else
return AuTime::SteadyClockNS() / 1000ull;
return AuTime::SteadyClockNS() / 10'000ull;
#endif
}
@ -197,7 +197,7 @@ namespace Aurora::RNG
do
{
t1 = RngTimeClock();
while (t1 == RngTimeClock()) // spin within 1 microseconds
while (t1 == RngTimeClock()) // spin within 1 microseconds (*)
{
a ^= 1; // flip
}
@ -207,6 +207,12 @@ namespace Aurora::RNG
{
b ^= 1; // flip
}
// Update 2023/Sept: Now x10 because we dont have enough timer res on some platforms.
// This is was generally never a CPU limitation or API limitation until Windows XP. Check software or motherboard...
// ...but still, let's continue.
// Deadlocking preprocess init, because for example the motherboard is failing or a VM configuration changed, is pretty dumb.
// (ask me how i know)
}
while (a == b); // ensure theres enough entropy for a deviation to occur
acc = (acc << 1) | a; // push the first bit state