Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

How does the Rand() function generate values?

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
ToniKautto
Employee
Employee

How does the Rand() function generate values?

Last Update:

Jul 23, 2021 7:59:50 AM

Updated By:

Sonja_Bauernfeind

Created date:

Dec 30, 2013 5:03:29 AM

The Rand() function returns a uniform distribution of values. The value range is 0 to 1. 
 

Environment:


The numeric sequence is not predictable, so two consecutive reloads will not generate the same sequence of values.
 
For example, if Rand() is used to generate one million random values in the range 0 to 4:
 
LOAD 
    Floor(Rand()  *  5) AS RandValue
AutoGenerate 1000000;​

The result will be something like the chart below, where the result is uniformly distributed over the range 0 to 4.
 
chart uniformly distributed over a range.png
Labels (1)
Contributors
Version history
Last update:
‎2021-07-23 07:59 AM
Updated by: