Select Page

Sometimes we want to set a random number in a form field. It is easy to do it in Formidable forms with the help of the “Default value” calculation.

In the “Default value” option, select calculator and set the value to Math.floor(Math.random() * 100) + 1 to generate a random number between 1 and 100.

Use the following formula to generate a random number in any value range by replacing min and max values.
Math.floor(Math.random() * (max - min + 1)) + min

Here is a working example

Random number in a field