ZipExec icon indicating copy to clipboard operation
ZipExec copied to clipboard

Don't abuse PRNG -> fix identifier generation when building on Windows

Open hillu opened this issue 4 years ago • 2 comments

Pseudorandom number generators need to be initialized only once.

Using the system time for this is Generally Fine, but re-initializing the PRNG in a tight loop every time a random number is needed significantly raises the odds that the same number sequence (or even the same number) is returned every time.

Chances for this to happen on Windows are apparently much higher than on Linux. Not sure why this is the case, my best guess is that the clock used for Go's `time.Now()´ runs with coarser granularity.

hillu avatar Oct 22 '21 16:10 hillu

@Tylous Is this PR at all interesting to you?

hillu avatar Feb 07 '22 19:02 hillu

This is needed for it to work on Windows as well as Linux and and OSX

Tylous avatar Feb 09 '22 00:02 Tylous