You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4 KiB
JavaScript

function nameGen() {
var br = "";
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
nm1 = ["!", "@", "$", "%", "&", "*"];
nm2 = ["!", "@", "$", "%", "&", "*"];
nMs = "";
nSs = "";
if (i < 5) {
rnd = Math.floor(Math.random() * 4) + 3;
for (j = 0; j < rnd; j++) {
rnd2 = Math.random() * nm1.length | 0;
nMs = nMs + nm1[rnd2];
nm1.splice(rnd2, 1)
}
} else {
rnd6 = Math.floor(Math.random() * 4) + 3;
for (l = 0; l < rnd6; l++) {
rnd3 = Math.random() * nm1.length | 0;
nMs = nMs + nm1[rnd3];
nm1.splice(rnd3, 1)
}
rnd5 = Math.floor(Math.random() * 4) + 3;
for (n = 0; n < rnd5; n++) {
rnd4 = Math.random() * nm2.length | 0;
nSs = nSs + nm2[rnd4];
nm2.splice(rnd4, 1)
}
nMs = nMs + " " + nSs;
}
br = document.createElement('br');
element.appendChild(document.createTextNode(nMs));
element.appendChild(br);
}
if (document.getElementById("result")) {
document.getElementById("placeholder").removeChild(document.getElementById("result"));
}
document.getElementById("placeholder").appendChild(element);
}