zelark / nano-id-cc

Nano ID collision calculator
https://zelark.github.io/nano-id-cc/
MIT License
45 stars 10 forks source link

Calculator for absolute number of IDs? #32

Closed borekb closed 1 year ago

borekb commented 3 years ago

I'd like to answer the question "how many rows there would need to be in our database for nanoid to have a 1% probability of producing an already existing ID". Just maybe an idea for this awesome calculator (I like the current approach, just think that maybe there could be an additional "view" on the probability).

zelark commented 2 years ago

Oh, I man, sorry I didn't answer you. I think I can thinking about it on my upcoming vacation.

KaKi87 commented 1 year ago

Hello, Any news on this ? Thanks

zelark commented 1 year ago

@KaKi87 thanks for kicking up this issue. I don't have time to work on this, however it seems like it won't take much. Is it ok if I format the number with Intl.NumberFormat('en', { notation: 'compact' })? A full number might take a lot of space, and it won't be human readable.

So the result will look like

image
KaKi87 commented 1 year ago

That looks nice, thanks.

KaKi87 commented 1 year ago

So, from the beginning, you already had the answer in the critical-number variable ? :o

zelark commented 1 year ago

So, from the beginning, you already had the answer in the critical-number variable ? :o

Yep! ^_^

borekb commented 1 year ago

This is fantastic, thanks a lot! ❤️