Generate 5 random numbers

good afternoon,

I need to generate 5 random numbers from 1 to 5 but they don’t necessarily have to be different; these numbers can be repeated since everything is completely random

regards

Survey Solutions assigns a single double precision random number to each interview (Quest.IRnd()).
Since this number is random, each of its 16 (if I remember correctly) decimal digits is random as well.
So you can generate 16 random integers between 0 and 9.
So in your case you just divide the digit by 2 and add 1 to get a random integer between 1 and 5.

and what would be the formula to extract 5 of the 16 random numbers from the Quest.IRnd () to be able to apply the formula of dividing it by 2 and adding 1 to it.
Thanks for the help

For example:

  • create a Double variable called random with the expression: Quest.IRnd()
  • create Long Integer variables, say: randomInteger3, with the expression: Convert.ToInt16(random.ToString()[1+3].ToString())

randomInteger3 will return the 3rd digit after the decimal point (anything from 0 to 9).
(randomInteger3 / 2) + 1 will then give you an integer between 1 and 5.

Thank you very much for the information provided