Two stage randomization under multiple scenarios

Dear SurveySolution,

I am trying to implement the following scenario-based randomization.
I have two sensors and I need to make sure that SS selects the rooms where to place them as follows:

Scenario A: kitchen/main cooking area is indoors.

Sensor 1: by default in kitchen/main cooking area.
Sensor 2 random allocation: in the living room or bedroom.
First stage of random allocation: selection between living rooms or bedrooms
Second stage of random allocation: selection among one of the different living rooms or among one of the different bedrooms.

Scenario B: kitchen/main cooking area is outdoors:
Sensor 1: in living room
Sensor 2: in bedroom
If there is more than one living room or more than one bedroom, the placement will be randomly allocated between living rooms and bedrooms: i.e. randomly pick one of the living rooms and randomly pick one of the bedrooms.

Scenario C: kitchen/main cooking area and living room are outdoors:
Randomly allocate sensors to the available indoor rooms.

Scenario D: the household lives only in one room (which serves as kitchen/bedroom/living room):
Place one sensor only in that only room.

The link to the form (which contains a first attempt to implement the above), is here:

Any inspiration/suggestion on this will be highly appreciated. Happy to answer any clarification.

Thanks in advance,

I have done quite a bit of randomization in SuSo, so I decided to have a look at your questionnaire, but of course I don’t have access to it.
You don’t say what your problem is, so it is difficult to answer. One thing I see is that you have 2-stage randomization and SuSo only provides one random value: Quest.IRnd().
So you could either preload a second random value or you use something like the milliseconds in the timestamp of the currentDate question.
If you still have a problem, please describe it.

Dear Klaus,

Thanks for the suggestion. Please find attached the pdf version of the questionnaire (the section of interest is “Section T: Air pollution” - I hope this helps to clarify.
What I’m finding difficult is i) implementing the 2-stage randomization in scenario A); ii) have the remaining scenarios (which do not involve 2-stage randomization), correctly included in the rooms selection calculation.

From my end, I will try to import a random [0-1] number for the first stage of the randomization, then use the SS random number generator for the second stage - as I am not sure on how to access the millisecond part of the timestamp.

EmanueleHAP-Air pollution questionnaire.pdf (513.1 KB)

I am also realizing that, in order to prompt the 2 stage randomization, I need to count how many bedrooms and how many living rooms are recorded in the roster.

I’ve made a public copy of the questionnaire fyi. should be available here:


Unfortunately I cannot open your questionnaire ("You don’t have permission to edit this questionnaire ").
But in general, here is how you could do scenario A:
first select living or bedrooms with conditions:
(preloadedRandom<0.5) and (preloadedRandom>=0.5) respectively.

Then with noRooms being the number of such rooms:
(long) Math.Floor(((decimal)Quest.IRnd())*(decimal)noRooms) + 1
returns the selected room as an integer between 1 and noRooms.

The other scenarios can be done with similar expressions.