View Single Post
  #5  
Old 12-19-2012, 06:52 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by Starfire2001 View Post
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.
Ah I didn't remember if it did show the higher number. I was being safe.. also he said 1 or 3.. not 1 to 3.. ? so

PHP Code:
this.number int(random(0,2))*2
Would do 1.. plus it resulted in 1.. it added 1*2.. so it was either 1 or 3.
Reply With Quote