I have to assign random numbers between 0.6 - 1 for 500000 records in alteryx. I tried by using function called Randint() but its not working. can anyone please help me on this.
Thanks,
Bharath
Solved! Go to Solution.
Try Rand() instead of RandInt(); it will give you a real number between 0 and 1; then multiply (e.g. Rand() * 0.6 for your case should be very close to what you need)
(RANDINT(4000)/10000)+.6
Hi Marquee,
thank you for your reply. actually among the 500000 records some need to have 0.6, some should have 0.7, 0.8, 0.9 and 1 all these values should be randomly assigned for all the 50000 records.
Acutally I am trying to crate a variable column with random values from 0.6 - 1.0. so some values should have 0.6 , some should have 0.7 and some should have 0.8,0.9 but i dont know how specify the interval from and to
they should. I'm assigning values between 0 and 4,000 and then will be adding .6 to the product of the random number * .0001
this gets you random numbers between .6 and 1.
If you test this you should get min of .6 and max of 1 with avg of .8
Please do try it. I've got a sample module included with 500,000 records (generated).
Thanks,
Mark
I think I understand; could you try
SWITCH(RandInt(4),1, 0,0.6, 1,0.7, 2,0.8, 3,0.9)
This will give only the distinct values 0.6, 0.7, 0.8, 0.9, and 1. ...
(edit: But @MarqueeCrew answer that follows is better.)
if you only want {.6,.7,.8,.9,1} you can modify expression:
(RANDINT(4)/10)+.6
Hi Marquee,
yes it works. thank you for helping me. but 0.9 value is not assigned while using htis formula. is there any specific reason for this ?
Thanks,
bharath
I can only say RANDOM things happen. Here is a count from my test of 500,000 values.
rand | Count |
.6 | 99,714 |
.7 | 100,117 |
.8 | 100,058 |
.9 | 99,881 |
1 | 100,230 |