
-----------------------------------
cam
Sun Jan 21, 2007 2:18 pm

Rand Int
-----------------------------------
Why doesn't this work?


Rand.Int (1, 6)
if Rand.Int (1) then
    put "haha"
end if

-----------------------------------
lord_pwnerer
Sun Jan 21, 2007 3:00 pm

Re: Rand Int
-----------------------------------
var number : int

randint(number,1,6)

if number = 1 then
put"haha the number = 1"
end if


Use randint instead of Rand.Int... When you use randint you can assign a variable to the number, then check what that variable was set to.

EDIT: By the way, the reason that it doesn't work is when you wrote Rand.Int the second time, it was just like calling the procedure a second time, not checking to see what the random number was. (sorry if this doesn't make any sense, I'm in a rush)

-----------------------------------
Robert
Sun Jan 21, 2007 3:05 pm

RE:Rand Int
-----------------------------------
Rand.Int is a function...


if Rand.Int(1,6) = 1 then
     put "haha"
end if


Always use Rand.Int instead of randint

-----------------------------------
cam
Sun Jan 21, 2007 3:37 pm

Re: Rand Int
-----------------------------------
o thx very much

-----------------------------------
Cervantes
Sun Jan 21, 2007 7:37 pm

Re: Rand Int
-----------------------------------

Use randint instead of Rand.Int... When you use randint you can assign a variable to the number, then check what that variable was set to.

Please, don't say this. It's fantastically wrong. It's so wrong, we've even got a [url=http://www.compsci.ca/v3/viewtopic.php?t=14645]mini tutorial to explain it. Read it, and learn!
