Don't like ads? PRO users don't see any ads ;-)
Guest

random

By: andrew4582 on Feb 5th, 2012  |  syntax: JavaScript  |  size: 0.22 KB  |  hits: 124  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.     }