Hi community. I need to generate several random numbers but all of them need must be 6 digits.
I’m guessing I need to use the Rand() formula but I’m not been able to set the numbers to be only 6 digits.
Thanks in advance.
Solved! Go to Solution.
Hey @bersocha,
There is probably a smarter way of doing this but here is one option:
ToString(RandInt(9)) +
ToString(RandInt(9)) +
ToString(RandInt(9)) +
ToString(RandInt(9)) +
ToString(RandInt(9)) +
ToString(RandInt(9))
If you want the minimum option to be 100,000 could do this:
ToString(RandInt(8)+1) +
ToString(RandInt(9)) +
ToString(RandInt(9)) +
ToString(RandInt(9)) +
ToString(RandInt(9)) +
ToString(RandInt(9))
By 6 digits is 000001 a valid option?
Any questions or issues please ask :)
HTH!
Ira
if you are looking for exactly 6 digits (no less) you can use the formula RandInt(899999)+100000.
RandInt(899999) would give you a random integer between 1 and 899,999 then adding 100,000 would ensure that it is 6 digits.
1234567890
@bersocha if you have access to the R tools you can try using monte Carlo simulation