Last active
December 30, 2022 17:45
-
-
Save need12648430/704421395c6d06e114d4 to your computer and use it in GitHub Desktop.
Pronounceable Seeded Name Generator
This file contains 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
function name (id, l) { | |
function n(){return id=(399*id)%509} | |
var r="BDGKNPTVZ"[n()%9] | |
for (var i=1;i<l;i++) r+=i%2?"aeiou"[n()%5]:"bdgknptvz"[n()%9] | |
return r | |
}; | |
// id=seed, l=length | |
function name (id, l) { | |
// lcg prng | |
function n(){return id=(399*id)%509} | |
// first letter (capitalize) | |
var r="BDGKNPTVZ"[n()%9] | |
for (var i=1;i<l;i++) | |
// if i is odd, add a vowel; otherwise add a consonant | |
r+=i%2?"aeiou"[n()%5]:"bdgknptvz"[n()%9] | |
// return | |
return r | |
}; | |
// tests | |
console.log(name(1,5)) | |
console.log(name(2,5)) | |
console.log(name(3,7)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Examples: