Hello,

I'm trying to set up a questionnaire that will display only a random subset of all possible groups to participants, and I'm wondering, is it possible to do this with

Expression Manager (or a combination of javascript and EM)?

Within each group is a number of question variants, only one of which will be displayed to participants, selected at random. I found this to be very easy to implement with EM, thanks to

this example.
Displaying only a subset of possible groups is more difficult since multiple groups need to qualify as relevant, and the selection of each group needs to be independent of the other groups. That is, each group can't simply occur with a fixed selection of other groups; the probability of occurring with any other group must be equal.

I'm currently using an unsatisfactory work-around, in which I have a hidden equation question corresponding to each group that randomly generates 1 or 2, with the relevance of each group set to 1. This means that each group has 50% probability of being displayed to any given participant, and that each participant will see, on average, half of the possible groups, but also that some participants could end up seeing quite a bit more/less than that, which is undesirable.

I thought that a possible solution would be to have a hidden question that randomly shuffles an array of integers (corresponding to the total number of groups) and then takes a slice of that shuffled array. Each group would have a unique relevance value corresponding to an integer from within this array, and would be set to display if it's value is among the slice generated. This sounds simple enough to explain, but as I'm nearly programming illiterate, I don't know how difficult it is to actually implement. The first part I could probably manage but I don't if the second part is within the current capabilities of the relevance equations to specify. Is it possible, and if so, how?

If you've read this far, many thanks for your patience, please forgive my ignorance, and many apologies if I've accidentally left out any important details. Any reply would be much appreciated.