Random choose help

Hello everyone
I really need a help !!!

I want to choose a day of the week in a random way

Quel est le jour de reference


You can use the random variable which each interview gets during creation
and use it to pick a day of week like this:

new String[]{
}[(int) Math.Floor(Quest.IRnd()*7)]

Just as there is only one random value per interview yo uwill only get one random day of week like this of course.

1 Like

thank you for ur help
the draw works perfectly but each time I close the unfinished questionnaire and reopen it, the draw is automatically redone while I want to have a draw once for a questionnaire from start to finish (close and Reopen)

PS: the current day must not go out (the day we are)

how can i do

What do you mean by “close and reopen the questionnaire”? If you complete the interview and reopen it later the random selection stays the same as before.
If you open a new interview, of course, you will get a different selection.

What do mean by:

That if you start the interview on a Wednesday it should not be able to select Wednesday?

On the first part: @bayemanel , please note that if you try out your current questionnaire within the Designer using the Online Tester you indeed will always have a new draw every time you click on the Test button. But this is limited to the Online Tester as it replicates creating a new interview each time. You can avoid this by making use of scenarios. But once you create an interview using the Interviewer Application during fieldwork, the random selection will stay the same.

1 Like

it’s the same as I thought yesterday.
After deployment, things worked as I wanted
than kyou

I do a mistake @klaus sorry
It’s work now after I have done like I say on my reply to @peter_brueck
Many thanks

Hello everyone
@klaus and @peter_brueck
my random draw works wonderfully. Now I want it to be random depending on the individual
because it’s not great to see one day for all the individuals in the household
each individual does not necessarily have to have the same day

There is only one random value per interview: Quest.IRnd().
You could use single decimal digits from this double value to select the day for each list position (n-th digit for n-th individual) up to (I think) 17 digits.

I thought about it but I can’t manage to implement it

Perhaps see the section Random selection of 2 persons in HH in the public demo questionnaire for a hint.