When designing digital learning experiences, math educators often face a familiar challenge: how to generate variety in practice exercises while keeping problems relevant, solvable, and aligned with curriculum goals. That’s where smart automation comes in. LearningLemur, the platform developed by Wiris, continues to evolve, giving teachers tools that combine flexibility with precision.
Why Random Isn’t Always Reliable in Math Assessments
Imagine you’re a teacher creating randomized exercises about fractions. You want your students to practice adding fractions like 1/4 + 5/4. However, if the values vary randomly, the complexity of the problem shifts dramatically. A fraction like 4/2 simplifies to an integer, making it useless for your fraction-focused lesson. A case like 2/4 isn’t in its simplest form, which may confuse students or introduce an unintended learning objective.
Another common issue appears in algebra. Say you want students to solve a quadratic equation. For the equation to have real solutions, the discriminant (b² – 4ac) must be positive. If you generate coefficients a, b, and c randomly without constraint, you may accidentally create equations that only have complex solutions, going far beyond the intended scope of your lesson.
You might also encounter unexpected issues in more advanced topics. In linear algebra, randomly generated matrices might not be invertible, defeating the purpose of the activity. Or you might need vectors to be parallel, but uncontrolled random values lead to completely arbitrary orientations.
These examples reveal the core problem: random values alone aren’t enough. We need intelligent randomness, guided by advanced logic.
Why Smart Teachers Choose Algorithm Mode
Randomness can be incredibly useful when creating math practices and assessments, but it often brings more problems than solutions. Imagine assigning a worksheet where each student receives a slightly different version of the same problem. Sounds ideal, right? But if those random values aren’t controlled, you might end up with unsolvable equations, simplified fractions that bypass your objective, or algebra problems without valid solutions.
Teachers need flexibility without chaos. They want their students to practice diverse problems, but only within the right parameters. That’s where the challenge lies: how do you maintain variety while ensuring pedagogical accuracy?
This is the problem LearningLemur solves with its Algorithm Mode. It gives educators control over the logic behind random value generation, transforming variability into a tool for precision.

Introducing Algorithm Mode in LearningLemur
This powerful feature allows you, as an educator, to craft dynamic and sophisticated logical conditions by leveraging the flexibility and expressiveness of CalcMe code. Moving beyond standard logic options, you can now seamlessly handle random values, complex criteria, and custom conditions directly within your educational content.
With Algorithm Mode, you’re empowered to:
- Precisely control the generation of random values
- Define detailed conditions to exclude specific outcomes or ensure desired properties (for example, guaranteeing positive solutions, excluding integer results, or enforcing range limits)
- Define precise conditions that control how generated values interact within mathematical expressions. For example, ensuring variables are always in a specific order, the equation is solvable, or values relate proportionally.
All this is made possible through CalcMe, a powerful programming language already integrated within Wiris products. Even if you’re new to programming, CalcMe offers a straightforward approach to defining precise logical constraints without the complexity often found in traditional programming languages.
Algorithm Mode is a revolutionary feature inside LearningLemur. It allows educators to embed logic-based constraints in their math assessment workflows, turning random values into purposeful practice.
With Algorithm Mode, you can apply advanced logic to your problems so you can, for instance:
- Ensure fractions are irreducible by having numerator and denominator with greatest common divisor 1, so gcd(numerator, denominator)==1
- Control domains, ensuring only natural or rational numbers are used
- Guarantee invertibility in matrices
- Require that vectors be parallel
Here’s how Algorithm Mode turns those ideas into practice:
Example 1: Generating Irreducible Fractions
Imagine you’re designing a math exercise where students must add two fractions. If these are generated randomly, you risk getting fractions like 4/2 or 6/3 -values that simplify to integers and defeat the purpose of practicing fractions. With Algorithm Mode, you can ensure that all generated fractions are irreducible, keeping the learning objective focused and consistent.
# Generate the first fraction
# Choose a random numerator "a" from 1 to 9
a = random(1,9)
# Define set "B" of denominators that are coprime with "a"
B = { b with b in 2..9 where gcd(a,b)=1 }
# Choose random denominator "b" from set B
b = random(B)
# Generate the second fraction
# Choose another random numerator "c" from 1 to 9
c = random(1,9)
# Define set "D" of denominators coprime with "c", different from "b"
D = { d with d in 2..9 where gcd(c,d)=1 && d!=b }
# Choose random denominator "d" from set "D"
d = random(D)
# Calculate the sum of the two irreducible fractions
# The solution the students will calculate
sol = a/b + c/d
Example 2: Ensuring Matrices Are Invertible
Suppose you want students to practice calculating the inverse of a 2×2 matrix. If the matrix is created with random values, some may not be invertible, making the problem unsolvable. Algorithm Mode allows you to filter out such cases, ensuring that each generated matrix meets the necessary conditions for inversion.
# Define a function to generate random integers
r() := random(-5,5)
# Generate a matrix A (2x2) with a non-zero determinant, so invertible
repeat
A = [ [r(), r()],
[r(), r()]]
until determinant(A) != 0
# Define the matrix A^-1, inverse of A
sol= inverse(A)
Example 3: Controlling Vector Orientation
Think of a task where students must calculate the dot product of parallel vectors. Without constraints, randomly generated vectors could point in any direction, disrupting the intent of the exercise. Using Algorithm Mode, you can control how vectors relate to each other—for example, by ensuring they remain parallel or orthogonal depending on your learning goal.
#Define u,v components without any zeros
u1=random([-20..20]/[0])
u2=random([-20..20]/[0])
v1=random([-20..20]/[0])
v2=random([-20..20]/[0])
#Create vectors u,v
u=[u1,u2]
v=[v1,v2]
#Ensure they are orthogonal
while ((u*v)!=0) do
v1=random([-20..20]/[0])
v2=random([-20..20]/[0])
v=[v1,v2]
end
These examples show how Algorithm Mode elevates LearningLemur from a simple randomizer to an intelligent math assessment tool powered by advanced logic. Check out our documentation on Algorithm Mode to explore all the tool’s features, see more practical examples, and learn how to use it effectively.

Why Every Educator Needs Algorithm Mode
As soon as you begin creating math assessments involving random values, you’re engaging with logic, whether explicitly or not. Algorithm Mode formalizes this process, making it repeatable, scalable, and aligned with your learning objectives.
Teachers benefit from consistency, control, and efficiency. They no longer need to double-check every version of a problem. Students benefit from more predictable learning paths and challenges that match their level. When random values behave logically, education becomes more precise and engaging.
Whether you’re working on elementary arithmetic or complex calculus, Algorithm Mode in LearningLemur helps you keep the focus on what matters most: effective learning.
Smarter Math Starts with Smarter Logic
This enhancement joins another recent breakthrough in LearningLemur: an AI-powered math assessment generator that understands your needs and builds ready-made quizzes in seconds. Designed to help teachers kickstart math assessments efficiently, this tool allows you to:
- Describe the type of questions you want
- Receive an instant set of customized math problems
- Edit, refine, and assign them directly to your students
Forget starting from scratch. With this feature, you’re working smarter -not harder- within an intuitive platform built for educators, even those with limited tech experience. Algorithm Mode in LearningLemur is a game-changer for digital math education. It gives teachers the tools to guide random values, not be ruled by them. Whether you’re building fraction problems, designing vector exercises, or constructing invertible matrices, Algorithm Mode ensures your math assessments always make mathematical sense.
Share
