improve random seed (for dummy generators)
This commit is contained in:
parent
1317b57221
commit
a37ffd1f0c
@ -1435,9 +1435,18 @@ bool DummyPort::is_physically_connected () const
|
||||
}
|
||||
|
||||
void DummyPort::setup_random_number_generator ()
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
LARGE_INTEGER Count;
|
||||
if (QueryPerformanceCounter (&Count)) {
|
||||
_rseed = Count.QuadPart % UINT_MAX;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
_rseed = g_get_monotonic_time() % UINT_MAX;
|
||||
}
|
||||
_rseed = (_rseed + (uint64_t)this) % UINT_MAX;
|
||||
}
|
||||
|
||||
inline uint32_t
|
||||
DummyPort::randi ()
|
||||
|
Loading…
Reference in New Issue
Block a user