2022.1.1.30569 Patch Release Update

The 2022.1.1.30569 Patch/Minor release has been removed from the Download Portal due to a missing signature in some of the included files. This causes the files to not be recognized as valid files provided by Alteryx and might trigger warning messages by some 3rd party programs. If you installed the 2022.1.1.30569 release, we recommend that you uninstall it, and then install the latest 2022.1.1.30961 version.

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Generate a random number of 6 digits

bersocha
6 - Meteoroid

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.

2 REPLIES 2
IraWatt
15 - Aurora

Hey @bersocha,

There is probably a smarter way of doing this but here is one option:

IraWatt_0-1654205112325.png

 

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

 

cfugat
5 - Atom

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.

 

 

Labels