GenerateRandomSearch

Interval Arithmetic Generator

When a measurement is known only to within a range, the answer computed from it is also only known to within a range. Interval arithmetic tracks that directly, and makes a guarantee ordinary error bars do not: the true value is always inside, never missed. The price is that intervals only ever widen — and multiplication is where it gets interesting, because a range spanning zero can produce an answer far wider than either input suggests.

What this generator does

Generates two ranges, applies the chosen operation using the standard interval rules, and then samples thousands of individual pairs from within those ranges, confirming every single result falls inside the interval computed for them.

How to use this tool

  1. Choose an operation and generate two ranges.
  2. Work out the result range yourself before reading it — multiplication needs all four corner combinations.
  3. Check how many sampled points landed inside: it is always all of them.
  4. Compare how much wider the answer is than the inputs.

Understanding the controls

Operation
Addition and subtraction are straightforward; multiplication needs all four corner products because signs can flip; division requires the divisor to exclude zero, which is enforced.
How many samples
Between 100 and 20,000 points drawn from inside the input ranges and tested for containment. More samples make the guarantee more convincing without ever changing the interval.
Seed
Any word reproduces exactly the same ranges and result.

Common use cases

  • Propagating measurement uncertainty through a calculation
  • Teaching why multiplying ranges needs all four corners
  • Showing the difference between a guaranteed bound and a statistical one
  • Checking a hand calculation of error bounds
  • Setting the same example twice from a seed

How this generator works

Subtraction crosses the endpoints over — the smallest possible result is the low end of the first minus the *high* end of the second — which is the step most people get wrong first. Multiplication takes the minimum and maximum of all four corner products, because a range spanning zero makes the extremes unpredictable from the endpoints alone. Sampling then tests the guarantee empirically rather than trusting the rules.

Randomness and fairness

The ranges and the sampled points are random; the interval rules are exact. A seed reproduces the same example exactly and is therefore explicitly not cryptographically secure. Without a seed the browser's cryptographically secure generator is used.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • The intervals are correct but often pessimistic: using the same quantity twice is treated as if it could differ each time, which widens the answer beyond what is really possible.
  • One operation at a time; chaining several compounds that pessimism quickly.
  • Division by a range containing zero is refused rather than returning an unbounded answer.
  • No rounding-outward at the interval endpoints, which a rigorous implementation would add to stay sound under floating point.
  • Examples are not stored between visits; seed one you want again.

Privacy and your data

Both the arithmetic and the sampling run in your browser. Nothing about the ranges or your seed is transmitted or kept.