ClickHouse/docs/en/query_language/functions/random_functions.md

24 lines
931 B
Markdown
Raw Normal View History

# Functions for generating pseudo-random numbers
2017-04-26 19:16:38 +00:00
Non-cryptographic generators of pseudo-random numbers are used.
2017-04-03 19:49:50 +00:00
2017-04-26 19:16:38 +00:00
All the functions accept zero arguments or one argument.
If an argument is passed, it can be any type, and its value is not used for anything.
The only purpose of this argument is to prevent common subexpression elimination, so that two different instances of the same function return different columns with different random numbers.
2017-04-03 19:49:50 +00:00
## rand
2017-04-26 19:16:38 +00:00
Returns a pseudo-random UInt32 number, evenly distributed among all UInt32-type numbers.
Uses a linear congruential generator.
2017-04-03 19:49:50 +00:00
## rand64
2017-04-26 19:16:38 +00:00
Returns a pseudo-random UInt64 number, evenly distributed among all UInt64-type numbers.
Uses a linear congruential generator.
## randConstant
Returns a pseudo-random UInt32 number, The value is one for different blocks.
[Original article](https://clickhouse.yandex/docs/en/query_language/functions/random_functions/) <!--hide-->