Skip to content

Instantly share code, notes, and snippets.

@epireve
Created August 10, 2022 15:53
Show Gist options
  • Save epireve/dc7170d362bb01e65daaf90968345f2f to your computer and use it in GitHub Desktop.
Save epireve/dc7170d362bb01e65daaf90968345f2f to your computer and use it in GitHub Desktop.
Generate 16 alphanumerics license JS
function generatelicense() {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
var charactersLength = characters.length;
for (var i = 0; i < 16; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
if (i === 3 || i === 7 || i === 11) {
result += '-';
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment