Miscellaneous Functions

In this Topic:

Data Generation Usage Notes

  • Sequences generated by data generation functions are not guaranteed to be ordered and gap-free. This is because the numbers may be generated in parallel, in an unsynchronized fashion.

    For more details about sequences in Snowflake, see Using Sequences.

Random Distribution Usage Notes

  • Random distribution functions are deterministic.

  • Each random distribution function takes a generator expression, gen, as its last argument. The generator expression, gen, can be constant or variable:

    • If constant, then the result of the random distribution function is constant (unless there are other, variable arguments, which is currently only supported for the RANDSTR function).
    • If variable, then the result of the random distribution function is variable.
  • Generator expressions must be a type 64-bit integer, although implicit conversions are allowed. Any expression that can be converted into a 64-bit integer can be used as a generator expression.

  • The randomness of any random distribution function is directly linked to the randomness of its generator expression. For most practical purposes, the RANDOM data generation function is the best choice for randomly-generated integer values.