UNPKG

@xaroth8088/random-names

Version:

A random name generator for all kinds of things

94 lines (93 loc) 6.38 kB
export default function mandalorians() { let namelast; let names; let rnd; let rnd2; let rnd3; let rnd4; let rnd5; let rnd6; let rnd7; let rnd8; let rnd9; let rnd10; let rnd11; const type = Math.random() > 0.5 ? 0 : 1; const nm1 = ['', '', '', '', '', '', '', '', '', '', 'b', 'br', 'c', 'ch', 'd', 'dr', 'g', 'gh', 'gr', 'h', 'j', 'k', 'kr', 'l', 'll', 'm', 'n', 'nj', 'p', 'r', 'rh', 's', 't', 'tr', 'th', 'thr', 'v', 'vr', 'w', 'x', 'z']; const nm2 = ['a', 'e', 'i', 'o', 'u', 'a', 'e', 'i', 'o', 'u', 'a', 'e', 'i', 'o', 'u', 'a', 'e', 'i', 'o', 'u', 'a', 'e', 'i', 'o', 'u', 'a', 'a', 'a', 'o', 'o', 'o', 'u', 'u', 'u', 'a', 'o', 'u', 'ae', 'uu', 'ii', 'aa', 'ea', 'ai', 'ee', 'io', 'oe']; const nm3 = ['b', 'bb', 'd', 'dd', 'g', 'gg', 'j', 'k', 'kk', 'l', 'll', 'm', 'n', 'nn', 'p', 'r', 'rr', 's', 'ss', 't', 'v', 'y', 'b', 'd', 'g', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'y', 'b', 'bb', 'br', 'bz', 'd', 'dd', 'dz', 'dr', 'g', 'gg', 'gb', 'gd', 'ht', 'j', 'k', 'kk', 'kb', 'kd', 'kr', 'ksh', 'l', 'll', 'lm', 'lr', 'm', 'mz', 'n', 'nd', 'ng', 'nn', 'nt', 'nz', 'p', 'ps', 'r', 'rbr', 'rd', 'rg', 'rk', 'rr', 'rst', 'rt', 'rth', 's', 'sc', 'ss', 't', 'ty', 'v', 'y', 'zd']; const nm4 = ['', '', '', '', '', '', '', 'c', 'ck', 'd', 'dth', 'g', 'gg', 'gr', 'j', 'k', 'l', 'ld', 'm', 'n', 'ng', 'nk', 'nn', 'nx', 'r', 'rk', 'rr', 'rt', 's', 't', 'th', 'ts', 'x', 'z']; const nm5 = ['', '', '', '', '', 'b', 'bh', 'd', 'f', 'h', 'j', 'jh', 'k', 'kh', 'l', 'm', 'n', 'ph', 'r', 's', 'sh', 't', 'th', 'v', 'vh', 'w', 'wh', 'x', 'z', 'zh']; const nm6 = ['a', 'e', 'i', 'o', 'u', 'a', 'i', 'a', 'e', 'i', 'o', 'u', 'a', 'i', 'a', 'e', 'i', 'o', 'u', 'a', 'i', 'a', 'e', 'i', 'o', 'u', 'a', 'i', 'aa', 'ao', 'ay', 'oo', 'ae', 'ai', 'ia']; const nm7 = ['b', 'bb', 'd', 'dd', 'g', 'gg', 'j', 'k', 'kk', 'l', 'll', 'm', 'n', 'nn', 'p', 'r', 'rr', 's', 'ss', 't', 'v', 'y', 'b', 'd', 'g', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'y', 'b', 'c', 'g', 'k', 'n', 'r', 's', 't', 'th', 'v', 'b', 'c', 'g', 'k', 'n', 'r', 's', 't', 'th', 'v', 'b', 'c', 'g', 'k', 'n', 'r', 's', 't', 'th', 'v', 'b', 'bb', 'c', 'ch', 'd', 'dh', 'f', 'ff', 'g', 'h', 'hh', 'k', 'l', 'll', 'm', 'mm', 'mn', 'mr', 'ms', 'n', 'nr', 'nm', 'nt', 'ph', 'r', 'rr', 'rs', 'rt', 'rn', 'rm', 'rl', 's', 'ss', 'sh', 'st', 'sth', 'sm', 'sn', 'sl', 'sk', 't', 'th', 'v', 'vl']; const nm8 = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'c', 'h', 'k', 'l', 'lk', 'm', 'n', 'rn', 's', 'sh', 'th']; const nm9 = ['', '', '', '', '', 'b', 'bl', 'br', 'c', 'ch', 'cr', 'd', 'dr', 'f', 'g', 'h', 'j', 'k', 'kr', 'l', 'm', 'n', 'p', 'q', 'r', 's', 'sh', 'sk', 'sp', 'st', 'str', 't', 'tr', 'v', 'w', 'wr', 'z']; const nm10 = ['a', 'e', 'i', 'o', 'u', 'a', 'o', 'u', 'y', 'a', 'e', 'i', 'o', 'u', 'a', 'o', 'u', 'y', 'a', 'e', 'i', 'o', 'u', 'a', 'o', 'u', 'y', 'oo', 'ou', 'ai', 'ua', 'au', 'uu']; const nm11 = ['b', 'bb', 'd', 'dd', 'g', 'gg', 'j', 'k', 'kk', 'l', 'll', 'm', 'n', 'nn', 'p', 'r', 'rr', 's', 'ss', 't', 'v', 'y', 'b', 'd', 'g', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'y', 'b', 'ch', 'd', 'f', 'g', 'gg', 'gr', 'h', 'k', 'kk', 'l', 'lb', 'lg', 'lk', 'll', 'm', 'n', 'nk', 'pm', 'r', 'rh', 'rk', 'rm', 'rn', 'rr', 'rv', 'rvh', 's', 't', 'v', 'vh', 'x', 'zl']; const nm12 = ['', '', '', '', '', 'c', 'd', 'g', 'gg', 'gh', 'hl', 'k', 'l', 'll', 'n', 'ng', 'ngh', 'nch', 'r', 'rd', 'rr', 'rs', 'rn', 'rt', 's', 'ss', 'st', 't', 'tt', 'wr']; const nm13 = ['b', 'bb', 'd', 'dd', 'g', 'gg', 'j', 'k', 'kk', 'l', 'll', 'm', 'n', 'nn', 'p', 'r', 'rr', 's', 'ss', 't', 'v', 'b', 'd', 'g', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v']; const i = Math.floor(Math.random() * 10); { rnd7 = Math.floor(Math.random() * nm9.length); rnd8 = Math.floor(Math.random() * nm10.length); rnd10 = Math.floor(Math.random() * nm12.length); if (i % 2 !== 0) { rnd9 = Math.floor(Math.random() * nm10.length); rnd11 = Math.floor(Math.random() * nm11.length); namelast = nm9[rnd7] + nm10[rnd8] + nm11[rnd11] + nm10[rnd9] + nm12[rnd10]; } else { while (rnd7 < 5) { rnd7 = Math.floor(Math.random() * nm9.length); } while (rnd10 < 5) { rnd10 = Math.floor(Math.random() * nm12.length); } namelast = nm9[rnd7] + nm10[rnd8] + nm12[rnd10]; } if (type === 1) { rnd = Math.floor(Math.random() * nm5.length); rnd2 = Math.floor(Math.random() * nm6.length); rnd5 = Math.floor(Math.random() * nm8.length); if (i < 4) { while (rnd < 5) { rnd = Math.floor(Math.random() * nm5.length); } names = `${nm5[rnd] + nm6[rnd2] + nm8[rnd5]} ${namelast}`; } else if (i < 8) { rnd3 = Math.floor(Math.random() * nm7.length); rnd4 = Math.floor(Math.random() * nm6.length); names = `${nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd4] + nm8[rnd5]} ${namelast}`; } else { rnd3 = Math.floor(Math.random() * nm13.length); rnd4 = Math.floor(Math.random() * nm6.length); rnd6 = Math.floor(Math.random() * nm13.length); rnd7 = Math.floor(Math.random() * nm6.length); names = `${nm5[rnd] + nm6[rnd2] + nm13[rnd3] + nm6[rnd4] + nm13[rnd6] + nm6[rnd7] + nm8[rnd5]} ${namelast}`; } } else { rnd = Math.floor(Math.random() * nm1.length); rnd2 = Math.floor(Math.random() * nm2.length); rnd5 = Math.floor(Math.random() * nm4.length); if (i < 4) { while (rnd < 10) { rnd = Math.floor(Math.random() * nm1.length); } while (rnd5 < 7) { rnd5 = Math.floor(Math.random() * nm4.length); } names = `${nm1[rnd] + nm2[rnd2] + nm4[rnd5]} ${namelast}`; } else if (i < 8) { rnd3 = Math.floor(Math.random() * nm3.length); rnd4 = Math.floor(Math.random() * nm2.length); names = `${nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm4[rnd5]} ${namelast}`; } else { rnd3 = Math.floor(Math.random() * nm13.length); rnd4 = Math.floor(Math.random() * nm2.length); rnd6 = Math.floor(Math.random() * nm13.length); rnd7 = Math.floor(Math.random() * nm2.length); names = `${nm1[rnd] + nm2[rnd2] + nm13[rnd3] + nm2[rnd4] + nm13[rnd6] + nm2[rnd7] + nm4[rnd5]} ${namelast}`; } } return names; } }