nanoid.d is a tiny, URL-friendly unique string ID generator for D, developed as a D rewrite of nanoid for JavaScript.
Safe: (nope) nanoid.d is safe if you use a cryptographically strong random API, but Random
from std.random
is used by default.
Small: 2 lines of code. Yep, only 2 of them. std.random
provides a function to choose random elements from an array, which has a proper distribution of symbols.
It can be done in 1 line, but, you know, optimizations are very important.
Fast: nanoid()
returns a lazy range, which means that everything is computed only when needed.