[*] Update fallback RNG entropy: reduce expected tick resolution
This commit is contained in:
parent
cea3362186
commit
cf7be329d6
@ -174,7 +174,7 @@ namespace Aurora::RNG
|
|||||||
#if 0
|
#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)
|
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
|
#else
|
||||||
return AuTime::SteadyClockNS() / 1000ull;
|
return AuTime::SteadyClockNS() / 10'000ull;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ namespace Aurora::RNG
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
t1 = RngTimeClock();
|
t1 = RngTimeClock();
|
||||||
while (t1 == RngTimeClock()) // spin within 1 microseconds
|
while (t1 == RngTimeClock()) // spin within 1 microseconds (*)
|
||||||
{
|
{
|
||||||
a ^= 1; // flip
|
a ^= 1; // flip
|
||||||
}
|
}
|
||||||
@ -207,6 +207,12 @@ namespace Aurora::RNG
|
|||||||
{
|
{
|
||||||
b ^= 1; // flip
|
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
|
while (a == b); // ensure theres enough entropy for a deviation to occur
|
||||||
acc = (acc << 1) | a; // push the first bit state
|
acc = (acc << 1) | a; // push the first bit state
|
||||||
|
Loading…
Reference in New Issue
Block a user