# 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)
F7a-F7e
F8a-F8e
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 :).

Best,
Rick
edited Feb 13, 2018

+1 vote

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);
fisherYates(\@fArr);
foreach my \$fVal (@fArr) {
if (\$fVal == 1) {
my @f6Arr = (2, 3, 4, 5, 6, 7);
fisherYates(\@f6Arr);
foreach my \$f6Val (@f6Arr) {
}
}
elsif (\$fVal == 8) {
my @f7Arr = (8, 9, 10, 11, 12);
fisherYates(\@f7Arr);
foreach my \$f7Val (@f7Arr) {
}
}
elsif (\$fVal == 13) {
my @f8Arr = (13, 14, 15, 16, 17);
fisherYates(\@f8Arr);
foreach my \$f8Val (@f8Arr) {
}
}
else {