grawlixGenerator.js (1440B)
1 function nameGen() { 2 var br = ""; 3 var element = document.createElement("div"); 4 element.setAttribute("id", "result"); 5 for (i = 0; i < 10; i++) { 6 nm1 = ["!", "@", "$", "%", "&", "*"]; 7 nm2 = ["!", "@", "$", "%", "&", "*"]; 8 nMs = ""; 9 nSs = ""; 10 if (i < 5) { 11 rnd = Math.floor(Math.random() * 4) + 3; 12 for (j = 0; j < rnd; j++) { 13 rnd2 = Math.random() * nm1.length | 0; 14 nMs = nMs + nm1[rnd2]; 15 nm1.splice(rnd2, 1) 16 } 17 } else { 18 rnd6 = Math.floor(Math.random() * 4) + 3; 19 for (l = 0; l < rnd6; l++) { 20 rnd3 = Math.random() * nm1.length | 0; 21 nMs = nMs + nm1[rnd3]; 22 nm1.splice(rnd3, 1) 23 } 24 rnd5 = Math.floor(Math.random() * 4) + 3; 25 for (n = 0; n < rnd5; n++) { 26 rnd4 = Math.random() * nm2.length | 0; 27 nSs = nSs + nm2[rnd4]; 28 nm2.splice(rnd4, 1) 29 } 30 nMs = nMs + " " + nSs; 31 } 32 br = document.createElement('br'); 33 element.appendChild(document.createTextNode(nMs)); 34 element.appendChild(br); 35 } 36 if (document.getElementById("result")) { 37 document.getElementById("placeholder").removeChild(document.getElementById("result")); 38 } 39 document.getElementById("placeholder").appendChild(element); 40 }