3 ms·
Depends how much randomness you need. I usually just use a rand alpha of length 6-8. You can also use dictionary words (see gfycat). Sample Ruby code: 8.tim
by gurgeous 6y ago
Depends how much randomness you need. I usually just use a rand alpha of length 6-8. You can also use dictionary words (see gfycat).
Sample Ruby code:
8.times.map { (('a'..'z').to_a + (0..9).to_a).sample }.join
It's less collision resistant than UUID, of course.