Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Generating Random Value between a set range

VoidWhichBinds
6 - Meteoroid

Hi everyone!

Is there a way to generate a random number between a set range of numbers? Let's say for example I want to create a random four digit value, I would set the parameters to generate a random number between 1000 & 9999.

6 REPLIES 6
Aaron_Harter
11 - Bolide

Hi @VoidWhichBinds, check out the RandInt function:

 5.PNG

T_Willins
14 - Magnetar
14 - Magnetar

Hi @VoidWhichBinds,

 

Subtract your lower bound from your upper bound (9999-1000 = 8999).  Then use the formula with the difference in a RandInt formula plus the lower bound:  RandInt(8999)+1000

grossal
15 - Aurora
15 - Aurora

Hi @VoidWhichBinds,

 

you can do this with the formula tool and a little trick:

 

grossal_0-1586977943456.png

 

 

RandInt(8999)+1000
Rand() * 8999 + 1000

 

 

Both ways basically work the same. Data Type is set to Int. So no matter if I use RandInt or Rand - I end up having an Integer.

 

Rand() will generate a number between 0 and 1 - next I multiply it with the range [9999-1000] and last I add you minimum value to it by adding 1000.

 

Workflow attached. 

 

Best

Alex

VoidWhichBinds
6 - Meteoroid

Thanks for providing this solution. At first using this method was generating decimals, so I surrounded the entire formula in a FLOOR() and it rounded out the values.

davidtestin
5 - Atom

hi

 

this is excel fx that generate random number btw  17162000000 and 17169999999

 

result 17168273382

 

Excel

=RANDBETWEEN(17162000000,17169999999)

 

can you help me make same in alteryx

davidtestin
5 - Atom

hi

 

need help with this

 

this is a excel fx =RANDBETWEEN(17162000000,17169999999)

 

generate random between 17162000000 and17169999999

 

result 17167263726

 

need help making same in alteryx

Labels