Skip to content

Instantly share code, notes, and snippets.

@need12648430
Last active December 30, 2022 17:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save need12648430/704421395c6d06e114d4 to your computer and use it in GitHub Desktop.
Save need12648430/704421395c6d06e114d4 to your computer and use it in GitHub Desktop.
Pronounceable Seeded Name Generator
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))
@sbrl
Copy link

sbrl commented May 21, 2015

Examples:

Kozik
Divut
Zetibib
Tapukun
Tagibup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment