View Single Post
  #4  
Old 12-19-2012, 06:20 PM
Starfire2001 Starfire2001 is offline
Unholy Nation
Starfire2001's Avatar
Join Date: Dec 2010
Location: The streets.
Posts: 156
Starfire2001 will become famous soon enough
Quote:
Originally Posted by greggiles View Post
So if I were to be doing 1 or 3, itd be..

PHP Code:
this.number int(random(1,3); 
No.

random(1,3) gives you a random number between 1 and 3 (though never the high number, in this case 3.) So for example, random(1,3) might give you 2.5, or 1.72, etc.

int() then rounds the number down to the nearest integer. (so 2.5 becomes 2, 1.99 becomes 1.)

So

PHP Code:
this.number int(random(1,3)); 
Would randomly select either 1 or 2.
__________________
-Ph8
Reply With Quote