- Categories:
 
ZIPF¶
Returns a Zipf-distributed integer, for N elements and characteristic exponent s.
Syntax¶
ZIPF( <s> , <N> , <gen> )
Usage notes¶
The computational cost of choosing a single random number is logarithmic in the argument
N. More importantly, the memory cost is linear forN. Because of this, the argumentNis limited to the inclusive range[1, 16777215].genspecifies the generator expression for the function. For more information, see Usage notes.The first two arguments (
sandN) must be constants.
Examples¶
SELECT zipf(1, 10, random()) FROM table(generator(rowCount => 10));
+-----------------------+
| ZIPF(1, 10, RANDOM()) |
|-----------------------|
|                     9 |
|                     7 |
|                     1 |
|                     8 |
|                     8 |
|                     2 |
|                     3 |
|                     8 |
|                     2 |
|                     5 |
+-----------------------+
SELECT zipf(1, 10, 1234) FROM table(generator(rowCount => 10));
+-------------------+
| ZIPF(1, 10, 1234) |
|-------------------|
|                 4 |
|                 4 |
|                 4 |
|                 4 |
|                 4 |
|                 4 |
|                 4 |
|                 4 |
|                 4 |
|                 4 |
+-------------------+