Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Nano ID: A tiny, secure URL-friendly unique string ID generator for JavaScript. Parent comment
I have an off-by-one error… your random function has a range of 5, so it should be max - min + 1:
bucket_size = 5 / 3
0 / (5/3) = 0 1 / (5/3) = 3/5 = 0 2 / (5/3) = 6/5 = 1 3 / (5/3) = 9/5 = 1 4 / (5/3) = 12/5 = 2
Yeah, I planned for 65535 randoms and 52 alphabet. It would still mildly bias to the first range mod alphabet_size elements.
There are no comments on this comment yet.
I have an off-by-one error… your random function has a range of 5, so it should be max - min + 1:
then > So, 0s and 1s are still more likely than 2 to appear.Yeah, I planned for 65535 randoms and 52 alphabet. It would still mildly bias to the first range mod alphabet_size elements.