3 ms·
From TFA: > My solution [for generating random numbers] has been to mix event timestamps into the random state: [...] That's a good, old, and proven technique
by rollcat 4y ago
From TFA:
> My solution [for generating random numbers] has been to mix event timestamps into the random state: [...]
That's a good, old, and proven technique that is worth highlighting (I would use only the youngest 2-3 bits however).
I wonder though if the author is not shooting themselves in the foot long-term for things like games, where you want to be able to replay the random number stream to hunt down bugs, or for networked game clients that need to run the simulation deterministically and in lockstep.
- somat 4y agoIf it's deterministic it's not random, it's a hash function. yes I know, it's called rand(). it is still a hash function(except on openbsd), just one with no standard. http://man.openbsd.org/rand http://man.openbsd.org/rand
- rollcat 4y agoFor games you don't need randomness; you need a function that returns next in a series of uniformly distributed numbers (which RNGs happen to satisfy). But more importantly, you do need determinism, for the reasons I stated above. We're calling that function "random" for the same reasons we'd call another function "dial", even though there's no telephone involved.