How do I generate a random integer between 6 and 9 and -6 and -9 that I use as a loop and merge fiel | XM Community
Skip to main content

Hi there,
How do I generate a random integer between 5 and 9 and -5 and -9 that I use as a loop and merge field?
Now the command ${rand://int/(5:9||-5:-9)} does not seem to work.

Thank you

Hi aphdts You can use Math.random() in order to generate random numbers. However can you please elaborate more on your use case such that we can work on it accordingly


Hi there, you can also use the Randomizer element and RandomNumber generator in the Survey Flow to generate specific ranges of random numbers, like in the below:
randnumber_specificranges.png


You would need to use Javascript in the block before you use the randomizer in the survey block and store the values in the embedded data randnumber as a workaround to view the random numbers.

Qualtrics does not support random number generation as a math operation:

https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/math-operations/#MathOperationsSyntax


True about the math operations! I went with the Piped Text option (insert Piped Text -> Random Number -> Integers) to generate the random numbers
InsertRandomNumber.png


That's great! That a new learning for me :-)


Thank you both Aanurag_QC and Tom_1842
I used the piped text option (insert Piped Text -> Random Number -> Integers) and it works ok!


Leave a Reply