Last active
June 6, 2018 00:14
-
-
Save danwdart/73e81e06667a70ad298f2cd7ee5ea24e to your computer and use it in GitHub Desktop.
Easy product keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Small | |
> Math.round(Math.random() * Number.MAX_SAFE_INTEGER).toString(36).toUpperCase().match(/.{1,4}/g).join(`-`); | |
'2DSH-DWGM-7X5' | |
// Long, like Windows 98 | |
> Array(5).fill().map(x => Array(5).fill().map(x => Math.floor(Math.random() * 36).toString(36)).join(``)).join(`-`).toUpperCase() | |
'1WH4O-WLUT5-DA1DJ-KNNCK-7A32I' | |
// No repeats for "fill" | |
> (a => a.map(x => a.map(x => Math.floor(Math.random() * 36).toString(36)).join(``)).join(`-`).toUpperCase())(Array(5).fill()) | |
'07GK4-YNLZH-TK38I-PH7YL-FPQ1Q' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment