Re:Random in the wild
by viraptor on Tuesday December 09, 2014 @11:03PM
(#8727626)
With all the comments author makes about nonstandard and crazy behaviour, he actually misses some practical solutions and makes fun of them.
"The one operation that was not observed was substracting the pid from the time. More research into this subject is warranted."
It's actually simple (even if still not effective on pid wraparound) - pid numbers grow, at a rate of at least 1 per program execution. Time grows at around 1 second per second. If you substituted pid from time, there's a good chance you would get the same seed by running the app twice in a row.
So it's added instead, so that it always grows. And we pretend the wraparound happens very rarely.
Broken behaviour? Sure. Practical solution that works for 99% cases where non-critical randomness is required? Definitely.
"The one operation that was not observed was substracting the pid from the time. More research into this subject is warranted."
It's actually simple (even if still not effective on pid wraparound) - pid numbers grow, at a rate of at least 1 per program execution. Time grows at around 1 second per second. If you substituted pid from time, there's a good chance you would get the same seed by running the app twice in a row.
So it's added instead, so that it always grows. And we pretend the wraparound happens very rarely.
Broken behaviour? Sure. Practical solution that works for 99% cases where non-critical randomness is required? Definitely.