(rand arg0 (? arg1))
  arg0: a num
  arg1: a num (optional)
  returns a num
F

Generates a random number.

(rand a) is equivalent to (rand 0 a).

(rand a b) generates a random number between a and b:

There is no requirement for b to be greater than a. For example, (rand -3) may return 0, -1 or -2; and (rand 5 3) may return 5 or 4.

The built-in random number generator uses a simple linear-congruential algorithm. It may not be appropriate when high-quality randomness is required.

bitsar
coin-flip