
-----------------------------------
jay_vee
Mon Jun 04, 2007 5:09 pm

getting one integer from Rand.Int
-----------------------------------
I need to use Rand.Int to choose a random number from 1 to 10. What I have is ship1X1 := Rand.Int (1, 10)  ->ship1X1 is my variable. Rand.Int gives me never ending values from 1 to 10 for ship1X1, how do I make it so that it only saves one number? I tried 

loop
        ship1X1 := Rand.Int (1, 10)
        exit when ship1X1 = 1 or ship1X1 = 2 or ship1X1 = 3 or ship1X1 = 4 or ship1X1 = 5 or ship1X1 = 6 or ship1X1 = 7 or     ship1X1 = 8 or ship1X1 = 9 or ship1X1 = 10 
end loop


which apparently was a waste of time, because it still ouputs more than one number.

Help please? :)

-----------------------------------
Clayton
Mon Jun 04, 2007 5:11 pm

RE:getting one integer from Rand.Int
-----------------------------------
what do you mean? having:

ship1X1 := Rand.Int (1, 10)

is all you need, ship1X1 will get a single value from 1 to 10.

-----------------------------------
Geostigma
Mon Jun 04, 2007 5:12 pm

RE:getting one integer from Rand.Int
-----------------------------------

if event then
Rand.Int (ship1X1,1, 10) 
end if


-----------------------------------
jay_vee
Mon Jun 04, 2007 6:19 pm

Re: getting one integer from Rand.Int
-----------------------------------
okay, sorry. The mistake I made was I put the Rand.Int in a procedure which I put in a loop -_-". So it kept giving me different numbers. But I fixed it :)
