## WeBWorK Problems

### Scrambled Order for PopUps

by Brittni Lorton -
Number of replies: 2

I feel like I might be missing something simple. I would like to have a few PopUps in a problem but I want the order of the choices to appear scrambled for the students, not in the same order every time. Any ideas? Here is a working example of what I am working with, as it is each popup menu has the options listed in the order I've typed them every time and not scrambled.

## DESCRIPTION

## Math for Liberal Arts, Venn Diagrams

## ENDDESCRIPTION

## DBsubject(Math for Liberal Arts)

## DBchapter()

## DBsection()

## Date(01/22/2020)

## Institution(Community College of Denver, Colorado Community College System)

## Author(Brittni Lorton)

## KEYWORDS('Venn diagram')

###########################

#  Initialization

DOCUMENT();

"PGstandard.pl",

"MathObjects.pl",

"parserPopUp.pl",

"PGML.pl",

"PGML.pl",

"PGcourse.pl",

"PGchoicemacros.pl",

);

###########################

#  Setup

$a =random(15,20,1);$b =random(8,12,1);

$c =random(8,12,1);$d =random(20,25,1);

$u =$a+$b+$c+$d; #universal$math = $a+$b; #number of students in a math class

$emp =$b+$c; #number of students employed$mathandemp = $b; #number of students in a math class that are employed$adefine = PopUp(

["?","students in a math class that are unemployed","students that are both employed and in a math class", "students who are employed but not in a math class", "students who are not employed and not in a math class"], "students in a math class that are unemployed",

);

$bdefine = PopUp( ["?","students in a math class that are unemployed","students that are both employed and in a math class", "students who are employed but not in a math class", "students who are not employed and not in a math class"], "students that are both employed and in a math class", );$cdefine = PopUp(

["?","students in a math class that are unemployed","students that are both employed and in a math class", "students who are employed but not in a math class", "students who are not employed and not in a math class"], "students who are employed but not in a math class",

);

$ddefine = PopUp( ["?","students in a math class that are unemployed","students that are both employed and in a math class", "students who are employed but not in a math class", "students who are not employed and not in a math class"], "students who are not employed and not in a math class", );$showPartialCorrectAnswers = 0;

###########################

#  Main text

BEGIN_PGML

[[$u]] students were surveyed. [[$math]] students were enrolled in a math class, and [[$emp]] were employed. [[$mathandemp]] were both enrolled in a math class and employed.

Define the meaning of each of the four regions of the following Venn diagram:

a represents:[_]{$adefine} b represents:[_]{$bdefine}

c represents:[_]{$cdefine} d represents:[_]{$ddefine}

END_PGML

ENDDOCUMENT();

### Re: Scrambled Order for PopUps

by Alex Jordan -

If you define them like:

$popup = PopUp([a,b,c,d],0); Then they will come out in that order: a, b, c, d. (And the 0th indexed answer is the correct one.) If you define them like:$popup = PopUp([[a,b,c,d]],0);

Then they will come out in random order. (And "a" is still the correct one.)

If you define them like:

\$popup = PopUp([[a,b,c],d],0);

Then they will come out with a,b,c in random order, and d at the end. (And "a" is still the correct one.)

Basically if any entry of the outer array reference is itself an array reference, that is what indicates to randomize the order of that subset.