ForHosting KIT · Math

Probability distribution validity checker

Four masses of 0.25 each pass the check with a sum of exactly 1. Paste a list of probabilities and see at once whether it is a valid distribution, which entries are negative or above one, and how far the total is from 1. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Probabilities
0.25, 0.25, 0.25, 0.25
You get
Quantity
4
Sum
1
Abs sum error
0
Tolerance
0.000000001

A discrete probability mass function is only a valid distribution when every mass is non-negative and the full list sums to one. Students, tutors, data scientists, and game designers constantly need a fast, deterministic check before they feed a vector into sampling code, entropy formulas, or exam keys. This probability distribution validity checker accepts an array of finite numbers, optionally a numeric tolerance for floating-point drift, and returns a structured verdict: whether the list is valid, the computed sum, absolute sum error, indices of any negative or above-one entries, and human-readable reasons when the check fails. An empty array is rejected as invalid input rather than reported as a hollow false result.

What makes a discrete PMF valid

In probability theory a finite-support discrete distribution is a list of masses p zero through p n minus one such that each mass is greater than or equal to zero and the sum of all masses equals exactly one. Those two axioms are enough: once every mass is non-negative and the total is one, no mass can exceed one either, because a single entry larger than one would force the remaining non-negative terms to overshoot or go negative.

In practice the axioms are checked separately so diagnostics can name both problems: a sign error that leaked a negative weight, and a normalisation bug that left the sum at zero point nine five or one point zero two. When both the non-negativity and sum-to-one tests pass, the response sets valid to true and leaves the reasons array empty. When either test fails, valid is false and reasons lists concrete English sentences you can show next to a form or log line without re-deriving the failure yourself.

The tool does not invent categories, sample from the masses, or estimate continuous densities: it only certifies or rejects the finite PMF axioms on the numbers you send.

Who checks probability lists before using them

Game and simulation teams validate loot tables, dice face weights, and procedural spawn tables before shipping, catching the classic off-by-epsilon bug where five rows sum to zero point nine nine nine because of repeated division. Machine-learning feature pipelines that estimate categorical distributions from histograms need a deterministic gate before log-likelihood or cross-entropy code assumes non-negative normalised masses. Quality engineers and reliability analysts turn empirical failure-mode counts into probability vectors and want a pure sum-and-sign check before reporting risk to non-statisticians.

Failed validation of empty or malformed input does not consume balance. Keep lists within the published size ceiling, pin the cleaned sum fields in automated tests, and you get reproducible PMF checks for homework, LMS plugins, and edge workers without standing up a statistics library of your own.

Classroom and homework checks

Let students paste a candidate probability vector and see immediately whether masses are non-negative and sum to one within tolerance.

Game and simulation tables

Validate loot tables, weighted random rows, and spawn distributions before shipping so runtime samplers never receive negative or unnormalised weights.

ML and data pipelines

Gate estimated categorical histograms before entropy, KL divergence, or sampling steps that assume a legal discrete PMF.

How do I check if a probability array is a valid PMF?

Send a non-empty probabilities array of finite numbers.

What happens if the array is empty?

An empty list cannot be a probability distribution, so empty input is rejected rather than returned as valid false.

Can individual probabilities be greater than one?

Combined with non-negativity, that usually also makes the sum fail the equals-one check, so valid is false.

How tight is the sum-to-one test?

By default |sum − 1| must be at most 1e-9. Pass tolerance (or tol, eps, epsilon) to choose another non-negative absolute tolerance up to 1.

Why does a list that sums to 0.999 fail?

Because the default tolerance is one billionth, and a gap of a thousandth is far larger. This often comes from dividing weights repeatedly; rescale the masses so they add up to 1, or set a wider tolerance on purpose.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/pmf-validity

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/pmf-validity \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"probabilities":[0.25,0.25,0.25,0.25]}'
{
  "probabilities": [
    0.25,
    0.25,
    0.25,
    0.25
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.pmf_validity",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

The same pure analytic path powers the free browser tool and the prepaid API, so homework oracles and production pipelines never disagree on a half-percent rounding case.

What makes a discrete PMF valid

This checker implements that classroom definition on a plain JSON array. It walks the list once, accumulates the sum, records every index with a negative mass, and records every index with a mass greater than one for optional reporting. It then compares the absolute difference between the sum and one against a tolerance epsilon that defaults to one times ten to the minus nine, which is tight enough for ordinary double-precision arithmetic after simple divisions yet wide enough for benign binary rounding of fractions such as one third repeated.

Input contract, response shape, and empty-array errors

An empty array, a missing field, or a string that splits into zero tokens is rejected with a clear message that a valid PMF needs at least one mass—those structural failures are billed as validation errors, not as valid false successes. Example: four equal quarters zero point two five each yield valid true with sum one. Example: zero point five, zero point five, zero point one yields valid false with a sum error of about zero point one. Example: zero point six and negative zero point one is invalid with a negative index and a bad sum. POST a JSON body with the required field probabilities, a non-empty array of finite numbers. Aliases probs, values, pmf, and distribution are accepted when probabilities is omitted so form widgets and scripts can reuse familiar names. Each entry may be a JSON number or a numeric string; non-finite values, blank strings, and non-numeric tokens fail with invalid_input naming the index. Optionally send tolerance (aliases tol, eps, epsilon), a finite non-negative absolute tolerance capped at one, to widen or tighten the sum-to-one test for known floating-point pipelines; omit it to use the default of one times ten to the minus nine. Pair the response with your own sampling or entropy code if you need further statistics; this endpoint only validates the distribution contract.

Where a PMF validity API earns its keep

Introductory statistics and discrete-math courses ask students to normalise raw frequency counts into probabilities and then prove the resulting vector is a legal distribution; a single trusted oracle that returns structured JSON speeds grading, demo setup, and interactive lesson design without trusting opaque spreadsheet rounding.

What does the probability distribution validity checker cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input such as an empty array is not billed.

Read the full KIT documentation →