RandBetween
generate a random integer within a specified range.
The RandBetween
function in Power FX is used to generate a random integer within a specified range.
Itβs particularly useful when you need to introduce an element of unpredictability in your app, such as assigning random IDs, selecting random items, or simulating random events.
Syntax
Lower
: The minimum integer in the range (inclusive).Upper
: The maximum integer in the range (inclusive).
You can also assign a column of Number data for the value of Lower
and Upper
:
When called, RandBetween
returns a random integer between the two provided values, Lower
and Upper
.
The values returned are uniformly distributed, meaning that every integer within the range has an equal chance of being selected.
Example
Let's say you want to generate a random number between 1 and 100:
Result: 43
, 84
, or any value within 1 and 100.
Last updated