You should use the full alphabet when generating random codes 0 ▲ Dale Swanson 169 days ago · 5 min read1003 words · Tech · hide · 0 comments This is going to be a post with a pretty limited audience, even by this blog's standards. I'll try to keep this post short so let me get to the point I want to make: If you're generating a random code to represent something (like a94a8fe5), rather than just using hexadecimal you should do the work to convert it to the full alphanumeric space (a-z and 0-9) instead (eg, 3z4xlz).As for why, you may notice that the second code (3z4xlz) is shorter than the first (a94a8fe5). Despite this, the chance that you randomly generate two identical codes by accident (a 'collision'), is about the same for both (technically it's twice as likely for the 6 character one vs the 8 character hex one, but we're looking at orders of magnitude of probability here, and you could change it to 7 characters and the chances would be far lower than the 8 character hex one).If you're not a software developer, this might seem like a weird point to be making, but hexadecimal is very common in programming, and as a… No comments yet. Log in to reply on the Fediverse. Comments will appear here.