random()

Table of Contents

Definition

random() returns a pseudo-random integer with the value ranging from zero to 231-1.

Examples

The following example returns two values. The first value is randomized between zero and 2,147,483,647. The second value is randomized between 0 and ten and then increased by one. Both values changes each time the query is executed.

| makeresults
| eval n=random()
| eval randomcalc=(random() % 10) + 1
Screenshot of the previous example’s result

Further Reading