v.22.11New Feature

Add randCanonical function for pseudo-random value generation in [0, 1)

Add function randCanonical, which is similar to the rand function in Apache Spark or Impala. The function generates pseudo random results with independent and identically distributed uniformly distributed values in [0, 1). #43124 (李扬).
Introduces the randCanonical function that generates pseudo-random numbers uniformly distributed in the range [0, 1), similar to the rand function found in Apache Spark and Impala.

Why it matters

This feature provides users with a reliable way to generate independent and identically distributed uniform random numbers in ClickHouse queries, which is useful for simulations, randomized algorithms, and sampling tasks, enhancing compatibility with functions in other big data platforms.

How to use it

Use the randCanonical() function within your SQL queries in ClickHouse to generate pseudo-random floating-point values between 0 (inclusive) and 1 (exclusive). For example:
SELECT randCanonical() FROM table