I don't mean like random(50), I random two values. Like 1 and 5. Each tick the value would be 1 or 5. Not in between.
Try this -
random(2) * 4 + 1
Random(2) gives you either 0 or 1.
Granted, this only works for the given example. A fancier method would use the conditional operator as such -
(random(2) = 0 ? numA : numB)
This acts like an if statement. numA is returned if the condition -- random(2) = 0 -- is true, and numB returns if false.
Another method not mentioned is using an array expression:
{1, 5} at (random(2)+1)
Some other examples:
{"spring", "summer", "fall", "winter"} at (random(4)+1)
{1, 1, 2, 3, 5, 7, 12} at (random(7)+1)
Develop games in your browser. Powerful, performant & highly capable.
Thanks for the idea rojo, I should use array expressions more often.
Thanks guys.