Guest User

Untitled

a guest
Feb 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. function randomNum(from, to) {
  2. return from + Math.floor( Math.random() * (to - from + 1) );
  3. }
  4. function randomChar(length){
  5. var library = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
  6. var res = '';
  7. for(var i=0; i<length; i++){
  8. res = [res, library[randomNum(0,9)]].join('');
  9. }
  10. return res;
  11. }
  12.  
  13. // randomChar(140)
Add Comment
Please, Sign In to add comment