andrew4582

random

Feb 5th, 2012
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     function random(max){
  2.         if(!max || max <= 0)
  3.             max = 101;
  4.        
  5.         var num = Math.floor(Math.random()* max);
  6.        
  7.         if(num === 0)
  8.             num = 1;
  9.  
  10.         return num;
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment