Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. var i, tmp, len = 20, pass = "";
  2.  
  3. function charGen() {
  4. return String.fromCharCode(Math.floor(Math.random() * (0x5a - 0x41) + 0x41));
  5. };
  6.  
  7. function numGen() {
  8. return String.fromCharCode(Math.floor(Math.random() * (0x39 - 0x30) + 0x30));
  9. };
  10.  
  11. function SymbGen() {
  12. return String.fromCharCode(Math.floor(Math.random() * (0x2f - 0x21) + 0x21));
  13. };
  14.  
  15. for (i = 0; i < len; i++) {
  16. tmp = Math.floor(Math.random() * (5 - 1) + 1);
  17. switch(tmp){
  18. case 1:
  19. pass += charGen();
  20. break;
  21. case 2:
  22. pass += numGen();
  23. break;
  24. case 3:
  25. pass += SymbGen();
  26. break;
  27. };
  28. };
  29.  
  30. <input type="checkbox" class="checkboxes" name="genMethod">
  31. <span>Number</span><br>
  32. <input type="checkbox" class="checkboxes" name="genMethod">
  33. <span>Symbols</span><br>
  34. <input type="checkbox" class="checkboxes" name="genMethod">
  35. <span>Chars</span><br>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement