invantive documentationpart of invantive cloud
Invantive Support ForumsLog In / Sign Up

RANDOM

Syntax

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> RANDOM[RANDOM]:::quoted
    RANDOM --> End((END))

Purpose

The RANDOM SQL function generates a random number between 0 and 1.

See also RAND, RANDOM_BLOB and RANDOM_TEXT.

Parameters:

  • Seed (optional, int32): Produce a repeatable sequence of random numbers each time that seed value is provided.

Returns: A random number between 0 and 1.

Examples

The following example generates a random number between 0 and 1; the actual value differs per invocation:

select random()

-------------------
0.443596436

The following example generates a random number between 0 and 1 using a seed:

select random(5)

-------------------
0.397313961