First of hello every one, its my first day with PICO 8.

My problem is that i try to select a sprite randomly but only between two sprite ids/variables but i cant seem to make it function. Im maybe just a bit too tired but would love some help thanks.

 ```function _init() sidetopl = rnd(9) sidetopr = rnd(3) sidelowl = rnd(7) sidelowr = rnd(5) end function _update() if (sidetopl == 8 or 9) then else sidetopl = rnd(9) end if (sidetopr == 2 or 3) then else sidetopr = rnd(4) end if (sidelowl == 6 or 7) then else sidelowl = rnd(7) end if (sidelowr == 4 or 5) then else sidelowr = rnd(5) end end ```
P#45846 2017-11-03 20:52 ( Edited 2017-11-04 00:53)

 ```if sidetop==8 or sidetop==9 then ...do something... end ```

And you don't need to wrap your conditions in parenthesis either. You can save some tokens that way.

But also know that rnd() will return a decimal between 0 and the number you pass. So rnd(9) will never return the number 9. At best it will return something like 8.9999. If you want a whole number, you need to use flr() with your rnd() - that will round it down to the nearest whole number.

 ```sidetop = flr(rnd(9)) ```

The example above will return 0,1,2,3,4,5,6,7 or 8. But never 9.
If you want want...

 ```sidetop = flr(rnd(9))+1 ```

This will return 1,2,3,4,5,6,7,8 or 9...but never 0.

I have some helper functions I use for getting random numbers. Maybe they can help you too.

 ```-- get a random number between min and max function random(min,max) n=round(rnd(max-min))+min return n end -- round number to the nearest whole function round(num, idp) local mult = 10^(idp or 0) return flr(num * mult + 0.5) / mult end ```
P#45847 2017-11-03 20:53 ( Edited 2017-11-04 00:56)