Rand
generate a random decimal number between 0 and 1.
Last updated
Was this helpful?
generate a random decimal number between 0 and 1.
Last updated
Was this helpful?
The Rand()
function in Power FX is used to generate a random decimal number between 0 (inclusive) and 1 (exclusive).
It is useful in scenarios where you need randomness in your app, such as for generating test data, randomizing user experiences, or adding unpredictability to your app's behavior.
This syntax generates a random decimal number greater than or equal to 0 and less than 1.
If you run this function, it might return a random number like 0.457298
, but the value will change every time it is executed.
You can randomize the display of certain components or items in your app.
For example, in your Product table, there is a column FilterValue
where you assign a random decimal value to each of your products.
Then, in the , you could use:
This randomly generates a value to compare with the ThisItem.FilterValue
and show different set of products to your customers each time they visit your shopping app.