Hi all! I would like to simulate a random number between 0 and 1 for every row of my data in a reproducible way. I am aware I can create random numbers with RAND() in a Formula tool, however they are not reproducible (to my knowledge). Is there a nice way to achieve this? I guess i could create the numbers separately and save the output and just use that for my workflow, however there might be a nicer solution?
Thanks,
Blaz
Solved! Go to Solution.
Hi @BlazB,
I don't believe there is a way to create a truly random number that could be repeated each time run as this would go against the initial "truly random" idea. The closest i can get is by using the IntToBin() function to convert an integer to its binary value. This way the value would be identical each time run, however wouldn't be between 0 and 1. Otherwise I would go down the same route as you, using the RAND() function and exporting separately.
If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.
Regards,
Jonathan
Hi @Jonathan-Sherman ,
thank you for your reply. I see what you mean with your solution, however it will not be appropriate for my workflow. I will need to go down the mentioned path of exporting the simulation results separately and using those as an input. Not the cleanest way, but will do the trick
Thanks again,
Blaz
Hi @BlazB
While the Rand() and RandInt() functions don't accept a seed value, the Simulation Sampling tool does, allowing for a repeatable random number stream. Configure it as shown below, sample parametrically with a uniform distribution, from 0 to 1
Change the number of iterations to be larger than the number of items in your input data. Join the output of this with your data on record position
resulting in the following random distribution on every run. Change the seed value to get a new list of random values
Note that the reported seed value is 1 more than the seed set in the Simulation Sampling tool.
Dan
Great job in documenting this solution.
Extremely helpful.
This is a great solution. Thanks
Throwing this message,when I try to replicate same
Hi @stevelogue1980,
You will need the predictive tools installed in order to successfully run the workflow, further detail on how to install is available at https://help.alteryx.com/current/designer/download-and-use-predictive-tools
Regards,
Jonathan