Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Don't forget to submit your entry for the Excellence Awards by October 30! | Need more information about the program? Check out the blog here

Create negative and positve random numbers

Highlighted
7 - Meteor

I need to generate random numbers across a file, positive and negative.  I know that i can use randint(200) and it will give me random numbers from 1-200.  I need to be able to create from -200 to 200.  

 

My process has previously done this in SQL server, but I need to transition this to Alteryx. 

 

Here is the SQL Server logic: 

SELECT [intial_number], Abs(Checksum(NewId())) % 201 - 100 As RandomNumber
FROM [dbo].[my_table]

 

Sample results

initial_numberRandomNumber
651.3271210
651.32712-8
582.1820869
651.3271281
651.32712-66
920.118797
913.195145-77
651.32712-50
971.7441449-79
248.1976315-37
1582.627353-50
1252.386255-3
962.820752196
Highlighted
16 - Nebula
16 - Nebula

Simplest is:

RandInt(400)-200

 

RandInt in Alteryx is 0-n I believe 

Highlighted
7 - Meteor

THANK YOU!!!  Worked Perfectly!!! 

 

Highlighted
Alteryx Partner

Is there a way to create random numbers that are always of 9 digits? As I understand it, randint() only takes a ceiling argument.

Labels