Splitmix32: Thirteen Lines of Beautiful Randomness
I went looking for a seeded PRNG in TypeScript and found splitmix32, a 32-bit pseudorandom number generator so elegant it made me want to understand every single bit.
Writing · Tagged
1 article
I went looking for a seeded PRNG in TypeScript and found splitmix32, a 32-bit pseudorandom number generator so elegant it made me want to understand every single bit.
Choosing ten distinct winners is not ten independent random choices. Every draw changes the distribution faced by the next one.
A classifier can print 0.93 without being correct 93% of the time. Softmax normalizes logits; calibration is a separate empirical claim.
After 10,000 events, every event has a 1% chance of occupying a 100-slot buffer. After a billion, the buffer is still fair and still holds 100.
A Bloom filter can rule out missing keys without storing the keys. Its false positives are not a defect; they are the price of the memory saved.
A latent variable can improve prediction without revealing the one true cause. Useful explanation and literal truth are different contracts.
`Math.floor` and `Math.round` differ by one word. For four choices, one is uniform; the other makes the middle values twice as likely.
Weights of 1, 2, and 7 turn into odds of 10%, 20%, and 70%. Chance remains, but the code finally admits that the options differ.