Hi @bsoares ,
Since you want it in 0001 to 9999 format, Use the below formula for input text to add zeros to the meet the same format.
Set this formula on Inputtext control:
If(
Len(Text(VarRandValue)) = 1,
Concatenate(
"000",
Text(VarRandValue)
),
Len(Text(VarRandValue)) = 2,
Concatenate(
"00",
Text(VarRandValue)
),
Len(Text(VarRandValue)) = 3,
Concatenate(
"0",
Text(VarRandValue)
),
Text(VarRandValue)
)
On button click set the formula as:
UpdateContext({VarRandValue:(RoundDown(9999 * Rand(), 0))})
This will take the numbers from 0 to 9999.
Please have a look in the working model you can see preceding zeros for the number which are less than 4 digits:

I hope this resolved your issue if you see any challenge let me know I am always happy to help.
Regards,
Krishna
If this post helps give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.