Skip to content

Instantly share code, notes, and snippets.

@bozheville
Created June 22, 2018 10:10
Show Gist options
  • Save bozheville/57c49935334c948fb33bc389e8e15fac to your computer and use it in GitHub Desktop.
Save bozheville/57c49935334c948fb33bc389e8e15fac to your computer and use it in GitHub Desktop.
random name generator
const randomContactName = () => {
const getCharFrom = set => set.charAt(
Math.round( Math.random() * ( set.length - 1 ) )
);
const getVowel = () => getCharFrom( 'aeiouy' );
const getConsonant = () => getCharFrom( 'bcdfghjklmnpqrstvwxz' );
let name = getConsonant() + getVowel() + getConsonant();
if ( Math.random() >= 0.5 ) {
name += name[ name.length - 1 ];
}
name += getVowel();
if ( Math.random() >= 0.5 ) {
name += getConsonant() + getVowel();
}
return name.charAt( 0 ).toUpperCase() + name.slice( 1 );
};
@bozheville
Copy link
Author

Generated data example:

[
  "Kommufo", "Qoppe",   "Viqqo",   "Luhuzu",  "Hejedy",
  "Vonnibo", "Dopiho",  "Jijigi",  "Lummu",   "Ryqqehe", 
  "Reqoga",  "Newwu",   "Rahimo",  "Dusso",   "Wyqe", 
  "Wihyno",  "Poqi",    "Qoroci",  "Tagu",    "Bucipe", 
  "Mikoru",  "Falle",   "Pyddy",   "Peto",    "Syly", 
  "Vypiva",  "Sixxe",   "Cule",    "Hellu",   "Qexiju", 
  "Moqe",    "Zupu",    "Qiseli",  "Peppocu", "Rojjo", 
  "Welodu",  "Koppy",   "Siddavo", "Vufywe",  "Zuggafu", 
  "Cavotu",  "Meqyso",  "Jalo",    "Cunnoho", "Cuhuxe", 
  "Lyppu",   "Keqiqy",  "Fece",    "Juvve",   "Reloky", 
  "Suki",    "Fubece",  "Moffony", "Fyvvage", "Naqqu", 
  "Jennony", "Tasu",    "Maduja",  "Sipoco",  "Lywwe", 
  "Hejike",  "Muhy",    "Qozzuro", "Wixi",    "Logge", 
  "Jyqito",  "Zicca",   "Gimu",    "Vosuse",  "Xumma", 
  "Teffo",   "Kahhi",   "Wiqy",    "Tissona", "Wezza", 
  "Dawwo",   "Ruxowu",  "Suffaho", "Mocugi",  "Niwwybu", 
  "Qynname", "Sijjo",   "Zekyko",  "Wittoti", "Xeqqinu", 
  "Zonnitu", "Likori",  "Xussudi", "Kyro",    "Qeddeqi", 
  "Wozy",    "Ramu",    "Gottova", "Pudyri",  "Wiffa", 
  "Wukky",   "Cudo",    "Vannevo", "Gywapo",  "Pini"
]

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