Welcome to the Creatures Wiki! Log in and join the community.


From Creatures Wiki
(Redirected from Rand)
Jump to navigation Jump to search

RAND is a CAOS command used to generate random numbers. You can think of it like a set of dice that will choose a whole number between and including the two numbers that you set.


RAND (integer) value1 (integer) value2 (integer)

Returns a random integer between value1 and value2 inclusive of both values. You can use negative values, and have them either way round.


Choosing a random X-location, but at a constant Y-location to move safely to.

mvsf rand 748 1550 9547

Choosing a random TICK, or time for the timer script to fire, between 5 and 10 minutes.

tick rand 6000 12000

Choosing a random velocity for an object to have.

velo rand -10 10 rand -15 -20

From the meerk's timer script, setting a temporary variable and using that to decide what action to take next.

setv va00 rand 0 5
doif va00 eq 0
doif carr eq null
gsub dig_
gsub sit_
elif va00 eq 1
gsub sit_
elif va00 eq 2
negv ov10
elif va00 eq 3
gsub run_
elif va00 eq 4
reps 3
gsub push
gsub walk

See also[edit]

  • RNDV, a similar command in C2.