Skip to main content

Categories: Math

RANDOM

Returns a random number between 0 (inclusive) and 1 (exclusive) for each row.

Syntax​

RANDOM([seed numeric]) → double​

  • seed (optional): Seed value for reproducible results. Must be an integer literal constant.

Examples

RANDOM example
SELECT RANDOM()
-- 0.24943567857336457
RANDOM example
SELECT RANDOM(4000)
-- 0.18633151868393985

Usage Notes​

If a seed value is specified, RANDOM generates a unique number for each row. If the same seed is used to call RANDOM on the same row multiple times, the same generated number will be returned each time.