On a project recently I needed to generate a large number of random serial keys, I couldn’t find any a simple/easy way to handle this, so here is my implementation. You specify the length you want and it will automatically insert a separator every 4 characters.

The second parameter,┬áseparator, is optional. It defaults to ‘-‘.

Leave a Reply

Your email address will not be published. Required fields are marked *

*