Number.RandomBetween

Updated on

Number.RandomBetween is a Power Query M function that generates a random number between two given numbers, bottom and top. The function returns the generated random number within the specified range.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Number.RandomBetween(
   bottom as number,
   top as number,
) as number

Description

Returns a random number between bottom and top.

Examples

Get a random number between 1 and 5.

// Output: 2.546797
Number.RandomBetween( 1, 5 )

Learn more about Number.RandomBetween in the following articles:

Other functions related to Number.RandomBetween are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/number-randombetween