Have an idea?

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

How can I randomize blocks of questions in a grid?

I have 13 questions in a grid and I need to keep questions 1-11  and 12-13 together. I want to randomize questions 1-11 and 12-13 and then randomize the blocks within the grid.

Any help will be much appreciated.
asked Nov 13, 2017 by jrasmussen720 (180 points)

1 Answer

+1 vote
Constructed lists are the way to go for this.  This constructed list code will randomize 1-11 and 12-13 and then randomly put one block before the other:

Add(list1, 1, 11)
Randomize()
Begin Unverified Perl
my $rand = rand();
if ($rand < 0.25) {
    ADD('list1', 12, 13);
}
elsif ($rand < 0.5) {
    ADD('list1', 13);
    ADD('list1', 12);
}
elsif ($rand < 0.75) {
    INSERT(1, 'list1', 12, 13);
}
else {
    INSERT(1, 'list1', 12);
    INSERT(1, 'list1', 13);
}
End Unverified


"list1" must be replaced with the name of the predefined list.
answered Nov 13, 2017 by Zachary Platinum Sawtooth Software, Inc. (94,775 points)
Nice work Zachary.

Should that last else statement be ...
else {
    INSERT(1, 'list1', 13);
    INSERT(1, 'list1', 12);
}
Actually, you are correct. I just realised you are using INSERT statements, not ADD statements so code 13 will be added last to the top of the list.

Top notch as always.
Thank you so much, this was just the solution I needed.
...