Advertisement
stuppid_bot

Random

Nov 17th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function rand(min, max) {
  2.     return Math.random() * (max - min + 1) - min;  
  3. }
  4.  
  5. function randInt(min, max) {
  6.     return Math.floor(rand(min, max));
  7. }
  8.  
  9. function randPassword(required) {
  10.     if (required === undefined)  {
  11.         required = 6;
  12.     }
  13.     var chars = '1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm';
  14.     var password = '';
  15.     for (var i = 0; i < required; ++i) {
  16.         password += chars.charAt(Math.floor(Math.random() * chars.length));
  17.     }
  18.     return password;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement