How does a random fraction generator work?
It picks a random denominator, then a random numerator smaller than it, and divides both by their greatest common divisor so the fraction is in simplest form. This tool returns proper fractions only, between 0 and 1, with a denominator no larger than the maximum you set. It runs in your browser using the Web Crypto random source.
Making a set of fractions
- Set Max denominator (2 to 1000, default 100). Use 10 or 12 for primary-school worksheets, 100 or more for harder practice.
- Set Fractions to how many you want (1 to 50).
- Click Generate. Each fraction appears on its own line as
numerator/denominator.
Repeats are possible; each fraction is drawn independently.
Example with denominators up to 12
With Max denominator 12 and Fractions 10, one run returned:
2/9
2/3
2/11
9/11
2/9
4/5
1/3
6/7
1/3
1/4
Ten fractions and three duplicates (2/9 twice, 1/3 twice). That's normal for a small denominator limit: there are only 45 distinct proper fractions in lowest terms with denominators from 2 to 12.
How the reduction works
The tool reduces each fraction with Euclid's algorithm, which finds the greatest common divisor (GCD) by repeatedly replacing the pair (a, b) with (b, a mod b) until the remainder is 0. For a draw of 18/24:
| Step | a | b | a mod b |
|---|---|---|---|
| 1 | 18 | 24 | 18 |
| 2 | 24 | 18 | 6 |
| 3 | 18 | 6 | 0 |
| 4 | 6 | 0 | stop: GCD is 6 |
Dividing both parts by 6 gives 3/4. Every output is already in lowest terms, so you can use the generator to check answers to a "simplify this fraction" exercise, or deliberately multiply results back up (3/4 to 9/12) to make simplification questions.
How often each fraction appears
Because the tool chooses the denominator first and then reduces, the results aren't spread evenly over the distinct fractions. Fractions with many equivalent forms appear more often. These shares were calculated exactly from the tool's method:
| Max denominator | Distinct possible fractions | Share that is 1/2 | Share of draws already in lowest terms |
|---|---|---|---|
| 12 | 45 | 17.1% | 74.5% |
| 100 | 3,043 | 3.0% | 63.5% |
The distinct counts are sums of Euler's totient φ(d) for d = 2 to the maximum, the sequence listed as OEIS A002088 (minus 1, since that sequence also counts 1/1). The rarest results are fractions like 11/12 or 99/100, whose denominator only appears when it's drawn directly with a coprime numerator.
For a worksheet, that skew is mostly a good thing: halves, thirds and quarters are the fractions students meet most, and they show up often enough to build fluency. If you want an even spread of harder fractions, raise the maximum denominator; the share of 1/2 falls quickly as the limit grows.
Ideas for using random fractions
- Comparison drills. Generate pairs and ask which is larger. 6/7 versus 4/5 is a good one: cross-multiply, 30 against 28, so 6/7 wins.
- Arithmetic practice. Take two results and add, subtract, multiply or divide them, then check the answer with the fraction calculator.
- Fraction to decimal and percent. Convert each result and confirm with the percentage calculator. Fractions whose reduced denominator has only 2 and 5 as prime factors (1/4, 4/5) terminate; others such as 2/9 repeat.
- Ratios. Read 2/3 as the ratio 2:3 and scale it up or down with the ratio calculator.
- Test data. Developers writing a rational-number class or a fraction parser can paste a batch in as input and compare the parsed values against a known-good implementation.
When you need decimal values instead, the random decimal generator produces numbers between any two bounds at a fixed precision.
Limits
The tool doesn't produce improper fractions, mixed numbers, negative fractions or a fixed denominator (for example "only twelfths"). The slider tops out at a denominator of 1000. Randomness comes from crypto.getRandomValues through a rejection-sampled integer pick (MDN), and nothing you generate leaves the page.
Last updated