{
  "id": "uniform-distribution",
  "title": "Uniform Distribution",
  "lang": "en",
  "source_lang": "en",
  "summary": "A probability distribution assigning equal probabilities to outcomes in a finite set, or constant density over a region of finite positive measure.",
  "category": "mathematics",
  "subcategory": "probability-statistics",
  "type": "concept",
  "aliases": [
    "Rectangular distribution",
    "Equidistribution"
  ],
  "generated_at": "2026-10-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/uniform-distribution/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/uniform-distribution/",
      "json": "https://aiwiki.page/zh/uniform-distribution.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A uniform distribution is a probability distribution that spreads probability evenly over a specified set. In the discrete case, every outcome in a finite set has the same probability. In the continuous case, equal-length subintervals within a bounded interval have equal probabilities. The term “rectangular distribution” refers to the rectangular graph of the continuous distribution’s density. Uniform distributions provide basic models for random selection and building blocks for simulation. (randomservices.org)"
    },
    {
      "heading": "Discrete uniform distribution",
      "text": "A random variable \\(X\\) is uniformly distributed on a finite set \\(S=\\{x_1,\\ldots,x_n\\}\\) when its probability mass function satisfies\n\n\\[P(X=x_i)=\\frac1n,\\qquad i=1,\\ldots,n.\\]\n\nConsequently, an event containing \\(k\\) of these outcomes has probability \\(k/n\\). The outcomes need not be numbers: a uniform distribution can describe selecting a card, a name, or another labeled object. A fair six-sided die is a numerical example, with each face having probability \\(1/6\\). (randomservices.org)\n\nFor consecutive integers \\(a,a+1,\\ldots,b\\), let \\(n=b-a+1\\). The expected value and variance are\n\n\\[E[X]=\\frac{a+b}{2}, \\qquad \\operatorname{Var}(X)=\\frac{n^2-1}{12}.\\]\n\nFor an arbitrary numerical set, the expectation is its arithmetic average, and the variance is the average squared deviation from that value. Equal probability does not require equal numerical spacing between outcomes. (randomservices.org)"
    },
    {
      "heading": "Continuous uniform distribution",
      "text": "For finite real numbers \\(a<b\\), the notation \\(X\\sim U(a,b)\\) denotes the continuous uniform distribution on the interval from \\(a\\) to \\(b\\). Its probability density function is\n\n\\[f_X(x)= \\begin{cases} \\dfrac{1}{b-a},&a\\le x\\le b,\\\\ 0,&\\text{otherwise}. \\end{cases}\\]\n\nThe density integrates to one. For \\(a\\le c\\le d\\le b\\),\n\n\\[P(c\\le X\\le d)=\\int_c^d f_X(x)\\,dx =\\frac{d-c}{b-a}.\\]\n\nThus, probability depends on interval length rather than location. For example, a uniform value between 2 and 10 falls between 3 and 5 with probability \\(2/8=1/4\\). (ocw.mit.edu)\n\nUnlike discrete outcomes, individual points have probability zero: \\(P(X=x)=0\\). Uniformity therefore means equal density, not positive equal probability for every real number. Including or excluding either endpoint leaves the probability distribution unchanged; changing a density at finitely many points does not affect its integral. (live.ocw.mit.edu)\n\nThe cumulative distribution function is\n\n\\[F_X(x)= \\begin{cases} 0,&x<a,\\\\ \\dfrac{x-a}{b-a},&a\\le x\\le b,\\\\ 1,&x>b. \\end{cases}\\]\n\nIts quantile function is \\(Q(p)=a+p(b-a)\\) for \\(0<p<1\\), so quantiles are equally spaced. The special case \\(U(0,1)\\) is called the standard uniform distribution. (randomservices.org)"
    },
    {
      "heading": "Moments and transformations",
      "text": "The continuous uniform distribution is symmetric about its midpoint, which is both its mean and median. Its principal moments are\n\n\\[E[X]=\\frac{a+b}{2}, \\qquad \\operatorname{Var}(X)=\\frac{(b-a)^2}{12}.\\]\n\nIts standard deviation is therefore \\((b-a)/\\sqrt{12}\\). Increasing the interval’s width increases dispersion, while shifting both endpoints by the same amount changes location without changing variance. (itl.nist.gov)\n\nIf \\(U\\sim U(0,1)\\), then \\(a+(b-a)U\\sim U(a,b)\\). Conversely, \\((X-a)/(b-a)\\) is standard uniform when \\(X\\sim U(a,b)\\). These affine transformations preserve uniformity. Nonlinear transformations generally do not: if \\(Y=U^2\\), direct calculation gives \\(P(Y\\le y)=\\sqrt y\\) for \\(0\\le y\\le1\\), rather than the linear cumulative distribution of a uniform variable. (randomservices.org)"
    },
    {
      "heading": "Simulation and probability transformations",
      "text": "Uniform random values are fundamental inputs for generating samples from other distributions. In inverse transform sampling, a standard uniform variable \\(U\\) is transformed using a target distribution’s generalized quantile function:\n\n\\[X=F^{-1}(U), \\qquad F^{-1}(u)=\\inf\\{x:F(x)\\ge u\\}.\\]\n\nThe resulting \\(X\\) has cumulative distribution function \\(F\\). The generalized inverse accommodates discrete distributions as well as continuous ones. (ocw.mit.edu)\n\nThe probability integral transform works in the opposite direction: if \\(X\\) has a continuous cumulative distribution function \\(F\\), then \\(F(X)\\) is standard uniform. For an invertible \\(F\\), this follows from\n\\(P(F(X)\\le u)=F(F^{-1}(u))=u\\).\nThe continuity requirement matters; applying a discrete cumulative distribution function does not ordinarily produce a continuous uniform variable. (ocw.mit.edu)"
    },
    {
      "heading": "Generalization and reference measures",
      "text": "In measure theory, uniformity is defined relative to a reference measure \\(\\mu\\). For a measurable set \\(S\\) with \\(0<\\mu(S)<\\infty\\),\n\n\\[P(X\\in A)=\\frac{\\mu(A\\cap S)}{\\mu(S)}.\\]\n\nCounting measure gives discrete uniform distributions, while Lebesgue measure gives uniform distributions over intervals and regions in Euclidean space. Equal-volume regions then have equal probability. Conditioning on a measurable subset of positive measure produces a uniform distribution on that subset. (randomservices.org)\n\nThe finite-measure condition excludes constant-density probability distributions over the entire real line. Likewise, no uniform probability distribution exists on a countably infinite set: a common positive point probability would sum to infinity, while a common zero probability would sum to zero. Uniformity is therefore a property of a specified domain and reference measure, not an unrestricted synonym for randomness. (randomservices.org)"
    },
    {
      "heading": "Statistical estimation",
      "text": "For independent observations from \\(U(a,b)\\), with both endpoints unknown and at least two distinct observations, maximum likelihood estimation gives\n\n\\[\\hat a=\\min_i X_i,\\qquad \\hat b=\\max_i X_i.\\]\n\nThe likelihood is proportional to \\((b-a)^{-n}\\) when the interval contains every observation, and is zero otherwise. It is maximized by the narrowest interval containing the sample. (itl.nist.gov)\n\nThese endpoint estimates are biased inward. For a sample of size \\(n\\),\n\n\\[E[\\hat a]=a+\\frac{b-a}{n+1}, \\qquad E[\\hat b]=b-\\frac{b-a}{n+1}.\\]\n\nThese formulas follow by rescaling the expected minimum and maximum of standard uniform observations. The expected gap between each estimate and its corresponding endpoint decreases as sample size increases. (itl.nist.gov)"
    }
  ],
  "links": [
    "probability-distribution",
    "probability",
    "random-variable",
    "probability-mass-function",
    "integer",
    "expected-value",
    "variance",
    "real-number",
    "probability-density-function",
    "integral",
    "cumulative-distribution-function",
    "quantile-function",
    "standard-deviation",
    "affine-map",
    "inverse-transform-sampling",
    "measure-theory",
    "lebesgue-measure",
    "euclidean-space",
    "subset",
    "statistical-independence",
    "maximum-likelihood-estimation",
    "likelihood-function"
  ],
  "sources": [
    {
      "title": "randomservices.org/random/special/UniformDiscrete.html",
      "url": "https://www.randomservices.org/random/special/UniformDiscrete.html"
    },
    {
      "title": "ocw.mit.edu/courses/1-017-computing-and-data-analysis-for-environmental-applica…",
      "url": "https://www.ocw.mit.edu/courses/1-017-computing-and-data-analysis-for-environmental-applications-fall-2003/f9b093c0fb8e619666b9be50b35fac86_class03_7.pdf"
    },
    {
      "title": "live.ocw.mit.edu/courses/6-436j-fundamentals-of-probability-fall-2018/9797310be…",
      "url": "https://live.ocw.mit.edu/courses/6-436j-fundamentals-of-probability-fall-2018/9797310bed4c7f5b5d40d007783eec8d_MIT6_436JF18_lec04.pdf"
    },
    {
      "title": "randomservices.org/random/special/UniformContinuous.html",
      "url": "https://www.randomservices.org/random/special/UniformContinuous.html"
    },
    {
      "title": "itl.nist.gov/div898/handbook/eda/section3/eda3662.htm",
      "url": "https://www.itl.nist.gov/div898/handbook/eda/section3/eda3662.htm"
    },
    {
      "title": "randomservices.org/random/dist/Transformations.html",
      "url": "https://www.randomservices.org/random/dist/Transformations.html"
    },
    {
      "title": "ocw.mit.edu/courses/14-310x-data-analysis-for-social-scientists-spring-2023/1dN…",
      "url": "https://ocw.mit.edu/courses/14-310x-data-analysis-for-social-scientists-spring-2023/1dNQkJKrdXt9evJyWJWGeG4QDIzfXOZ4C_transcript.pdf"
    },
    {
      "title": "ocw.mit.edu/courses/14-30-introduction-to-statistical-methods-in-economics-spri…",
      "url": "https://ocw.mit.edu/courses/14-30-introduction-to-statistical-methods-in-economics-spring-2009/resources/mit14_30s09_lec09/"
    },
    {
      "title": "randomservices.org/random/special/Uniform.html",
      "url": "https://www.randomservices.org/random/special/Uniform.html"
    },
    {
      "title": "itl.nist.gov/div898/software/dataplot/refman2/auxillar/ordstmea.htm",
      "url": "https://itl.nist.gov/div898/software/dataplot/refman2/auxillar/ordstmea.htm"
    }
  ],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}