The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

Random()

Returns a random number within a defined range.

The Random() function has two parameters:

  • lowerBound (number): Required. The smallest number that the function can return.
  • upperBound (number): Required. The largest number that the function can return.

To use this function, pass it a lower and an upper bound. The numbers can be positive or negative integer or decimal numbers. The order of the upperBound and lowerBound parameters in the function doesn’t matter.

The function returns a random number that is greater than or equal to the smallest number, and less than or equal to the largest number.