Random Fraction Generator
Generate random fractions instantly - proper, improper, or mixed. Customize numerator and denominator ranges, simplify to lowest terms, and copy results.
About
Generating fractions by hand for worksheets, test banks, or algorithm validation introduces bias. Humans default to small denominators and avoid edge cases like n = 0 or d = 1. This tool produces uniformly distributed random fractions across user-defined ranges for both numerator and denominator. It applies the Euclidean GCD algorithm to reduce each fraction to lowest terms when requested. Results are classified as proper (|n| < |d|), improper, or converted to mixed numbers. Zero denominators are excluded automatically.
The generator supports negative values, uniqueness enforcement, and decimal equivalents truncated to configurable precision. It is useful for educators building arithmetic drills, developers stress-testing rational-number libraries, and students practicing simplification. Note: the uniform random model treats each integer pair equally - it does not weight by Stern-Brocot distribution or Farey sequence density. For cryptographic-grade randomness, use a dedicated CSPRNG; this tool uses Math.random, which is adequate for educational and prototyping purposes.
Formulas
Each fraction is constructed by independently sampling a random integer numerator n and denominator d from user-specified ranges. The denominator excludes zero.
Simplification uses the Euclidean algorithm to find the greatest common divisor:
The reduced fraction is then:
For mixed number conversion, the whole part and remainder are extracted:
Where n = numerator, d = denominator, nr = reduced numerator, dr = reduced denominator, w = whole part, r = remainder, and rand(a, b) produces a uniform random integer in [a, b].
Reference Data
| Fraction Type | Condition | Example | Decimal | Use Case |
|---|---|---|---|---|
| Unit Fraction | n = 1 | 17 | 0.142857 | Egyptian fraction decomposition |
| Proper Fraction | |n| < |d| | 38 | 0.375 | Probability values, ratios |
| Improper Fraction | |n| โฅ |d| | 94 | 2.25 | Engineering ratios, slopes |
| Mixed Number | Whole + proper part | 2 14 | 2.25 | Measurement readings |
| Negative Fraction | n < 0 | โ56 | โ0.833 | Temperature deltas, debt ratios |
| Equivalent Fractions | Same value, different form | 24 = 12 | 0.5 | Simplification drills |
| Irreducible Fraction | gcd(n, d) = 1 | 711 | 0.6363 | Canonical form for computation |
| Reciprocal | Flip n and d | 43 โ 34 | 0.75 | Division by fraction |
| Terminating Decimal | d = 2a โ 5b | 38 | 0.375 | Exact decimal conversion |
| Repeating Decimal | d has prime factors โ 2, 5 | 13 | 0.333... | Periodic pattern analysis |
| Dyadic Fraction | d = 2k | 516 | 0.3125 | Binary floating point |
| Egyptian Fraction | Sum of distinct unit fractions | 12 + 13 | 0.833 | Historical number theory |
| Mediant | a + cb + d | 1+12+3 = 25 | 0.4 | Stern-Brocot tree construction |