4 ms·
"using a generator that won't fail" It seems your original function made the same assumption of V8's Math.random. All PRNGs fail at some point, even CSPRNGs. Y
by jorangreef 11y ago
"using a generator that won't fail"
It seems your original function made the same assumption of V8's Math.random. All PRNGs fail at some point, even CSPRNGs. You may as well write your code accordingly, with less optimistic assumptions.
If you're not going to be adding layers of safety, and if you're going to keep insisting that your PRNG "won't fail" then I guess it's only a matter of time before you will have to repeat the same mistake.
As other commenters have pointed out, you should have written your function in such a way that it does not place a critical reliance on any single component.
- mmalone 11y agoI generally trust peer reviewed formal mathematical proofs that show something won't "fail" in a particular, relevant, way. If you don't then you probably shouldn't be on a computer. The code I'm relying on makes the same sorts of assumptions that keep your data secure. It is inconsistent to trust it in one place but not in another. I don't see the need for belt-and-suspenders here and there are legit reasons not to add host/time to an identifier. That's why we have UUID1 and UUID4.
- jorangreef 11y agoYou should read more Colin Percival then. :) It's one thing to trust "peer reviewed formal mathematical proofs". It's another to assume that these are perfectly implemented.