-
MathType
-
WirisQuizzes
-
LearningLemur
-
CalcMe
-
MathPlayer
-
Store FAQ
-
VPAT for the electronic documentation
-
MathFlow
-
BF FAQ
-
Miscellaneous
-
Wiris Integrations
Create a randomized fraction addition question
Reading time: 3minIn this tutorial, you'll learn how to create a randomized math question using variables and computed answers.
Outcome: By the end of this tutorial, you will create a fraction addition question whose fractions are generated randomly each time a student attempts the exercise.
Before you begin
Prerequisites
- You should be comfortable working with basic fractions and have access to a LearningLemur-enabled course
- You should have completed Create an open-answer fraction addition question
Requirements
- A teacher account with permission to create questions in LearningLemur, accessed through learninglemur.com or your LMS
Step 0 — Create or open a quiz
Why: LearningLemur organises all questions inside quizzes, so creating a quiz first provides the workspace where you will add and manage your questions.
- Open LearningLemur
- Open an existing quiz or create a new one
Checkpoint: You should now see the quiz workspace with options to add questions.
Step 1 — Add a new question
Why: LearningLemur allows you to create questions either manually or with the help of AI. In this tutorial, we will create the question manually to understand how the editor works.
- Inside the quiz, click Add question
- In the creation dialog, choose Manually
- Select the Open answer question
This question type allows students to enter a mathematical expression using the math editor.
Checkpoint: You should see the Open Answer question editor, including fields for the title, statement, and answers.
Step 2 — Write the question statement
Why: The statement explains the problem students must solve. It will use variables instead of fixed values.
- Enter a Question title, for example: Sum of two random fractions
- In the Question statement, write the exercise text (these letters will later be defined as random variables)

You can use the MathType editor to format fractions using mathematical notation.
Checkpoint: The question statement should display the variables inside the fraction expression.
Step 3 — Define the random variables
Why: Random variables allow LearningLemur to generate a different version of the question each time.
- Open Question settings
- Locate the Random variables section
- Add the following variables:
| Variable | Value |
|---|---|
| num1 | random integer from 1 to 9 in steps of 1 |
| den1 | random integer from 2 to 9 in steps of 1 |
| num2 | random integer from 1 to 9 in steps of 1 |
| den2 | random integer from 2 to 9 in steps of 1 |
These variables will define the numerators and denominators of the two fractions.

Checkpoint: The variables should appear listed in the Random variables section.
Step 4 — Define the random expression (solution)
Why: Instead of defining the answer directly, LearningLemur allows you to compute the correct result using a random expression based on the generated variables.
- In the Random variables panel, go to Random expressions
- Click Add random expression
- Create the following expression:

This expression calculates the result of the fraction addition using the random values. LearningLemur automatically evaluates this expression and simplifies the result using the mathematical engine.
When building randomized questions, it is recommended to compute intermediate results using Random expressions, and reference them later in the Answers section. This keeps the question logic clearer and makes the question easier to maintain and modify.
Checkpoint: The variable sol should appear under Random expressions.
Step 5 — Define the correct answer
Why: LearningLemur needs to know the expected solution in order to evaluate student responses.
- Scroll to the Answers section
-
In the first answer field, enter the expression
#sol - Mark this answer as a Correct answer

Using #sol ensures the answer corresponds to the computed result of the random expression. LearningLemur will compare student responses with this expression using the mathematical evaluation engine.
Checkpoint: You should see the answer marked as a correct answer (100%).
Step 6 — Configure the evaluation
Why: Evaluation options determine how student answers are compared with the correct solution.
- Click Edit in the Evaluation options section
- Ensure Mathematically equal is selected

This allows LearningLemur to accept equivalent expressions.
You can also require the answer to be simplified or to be expressed in decimal form. You can see how to do so here.
Checkpoint: The evaluation summary should display something similar to:

Step 7 — Preview the question
Why: Previewing allows you to verify that the question generates different values and that LearningLemur evaluates the corresponding result correctly each time.
- Click Preview question
- Note the fraction values generated in the question
- Use Fill with correct answer, or calculate the result manually from the values shown
- Submit the answer
- Click Regenerate question and compare the newly generated values with the previous ones

LearningLemur automatically saves your changes while you edit the question. You do not need to manually save the question.
Checkpoint: Each preview can yield different fractions, and the correct answer is evaluated based on the values shown in that preview.
You're done
You have created your first randomized math question in LearningLemur. You learned how to:
- Define random variables
- Compute answers dynamically
- Evaluate expressions based on generated values
Next, you can continue learning with the following tutorials:
- Create an area question with units
- Create a randomized geometry question
- Configure partial scoring for units
You can also create more complex randomized questions using advanced logic. For example, you can ensure that each generated fraction is already irreducible (i.e., simplified before the operation). You can find more details here.
Troubleshooting
The same values always appear in the preview
Check that the question uses random variables in the statement and that the correct answer is based on a random expression, not on a fixed value.
The correct answer is marked as incorrect
Check that:
- The answer rule points to the computed expression (for example,
#sol) - The random expression is written correctly
- The evaluation option is set to Mathematically equal, not Literally equal
The question shows variables instead of numbers
Check that the variables used in the statement are defined in the Random variables section, and you are preceding them in the statement with the # symbol.