Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Randomizing questions within randomized blocks

Hi everyone,

I am trying to randomize a set of questions within a set of randomized questions. However, doing this via 'randomize -> blocks' gives an error as the randomization overlaps, which I understand.

The idea is this:
F5 (single question)
F6a-F6f (F6a, F6b, F6c, F6d, F6e, F6f, also goes for F7 and F8)
F9 (single question)

Now F5 and F6 should be grouped. F5 always first, F6 randomizes afterwards.
The sets of F7, F8 and F9 should randomize within itself (so F7c, F7a, F7d, etc., same goes for F8).
And F5&F6, F7, F8, and F9 can also randomize with each other.

An example: F7 -> F9 -> F5 & F6 -> F8. Done.

I heard you can do this with a predefined list and two constructed lists. I have one predefined list with 18 items (F5 to F9), and a constructed list that randomizes the set questions correctly within itself.
However, I cannot seem to get that second randomization, that F7 could come before F5 & F6, or F9 before F8. Etc.

Hope this is clear! And hopefully someone could help me out :).

asked Feb 13, 2018 by RickB (155 points)
edited Feb 13, 2018 by RickB

1 Answer

+1 vote
Best answer
Create a predefined list with 18 items.  Then create a constructed list that uses that predefined list as its parent.  The constructed list needs this code:

Begin Unverified Perl
sub fisherYates {
    my $array = shift;
    my $i = @$array;
    while (--$i) {
        my $j = int rand($i + 1);
        @$array[$i, $j] = @$array[$j, $i];

my $plist = 'list1';
my @fArr = (1, 8, 13, 18);
foreach my $fVal (@fArr) {
    if ($fVal == 1) {
        ADD($plist, 1);
        my @f6Arr = (2, 3, 4, 5, 6, 7);
        foreach my $f6Val (@f6Arr) {
            ADD($plist, $f6Val);
    elsif ($fVal == 8) {
        my @f7Arr = (8, 9, 10, 11, 12);
        foreach my $f7Val (@f7Arr) {
            ADD($plist, $f7Val);
    elsif ($fVal == 13) {
        my @f8Arr = (13, 14, 15, 16, 17);
        foreach my $f8Val (@f8Arr) {
            ADD($plist, $f8Val);
    else {
        ADD($plist, 18);
End Unverified

Line 11 should be updated with the name of the predefined list.

Finally, use randomized blocks on your questions with this constructed list.
answered Feb 13, 2018 by Zachary Platinum Sawtooth Software, Inc. (159,750 points)
selected Feb 15, 2018 by RickB