random

ReQL command: random

Command syntax

r.random() → number
r.random(number[, number], :float => true) → number
r.random(integer[, integer]) → integer

Description

Generate a random number between given (or implied) bounds. random takes zero, one or two arguments.

  • With zero arguments, the result will be a floating-point number in the range [0,1) (from 0 up to but not including 1).
  • With one argument x, the result will be in the range [0,x), and will be integer unless :float => true is given as an option. Specifying a floating point number without the float option will raise an error.