Continuous uniform distribution
In probability theory and statistics, the continuous uniform distribution, also known as the rectangular distribution, is a family of symmetric probability distributions where every value within a finite interval [a, b] (with a < b) has an equal probability of occurring, making it the simplest continuous distribution to model equally likely outcomes over a continuous range.[1][2] The probability density function (PDF) of a continuous uniform random variable X \sim U(a, b) is defined as f(x) = \frac{1}{b - a} for a \leq x \leq b and f(x) = 0 otherwise, ensuring the total probability integrates to 1 over the interval.[1][3] The cumulative distribution function (CDF) is F(x) = 0 for x < a, F(x) = \frac{x - a}{b - a} for a \leq x \leq b, and F(x) = 1 for x > b, which linearly increases from 0 to 1 across the support.[1][2] Key moments include the expected value (mean) \mu = \frac{a + b}{2}, which is the midpoint of the interval, and the variance \sigma^2 = \frac{(b - a)^2}{12}, reflecting the spread depending on the interval length.[1][3] The standard uniform distribution, U(0, 1), serves as a foundational case with mean 0.5 and variance $1/12 \approx 0.0833, often used to generate other distributions via transformations.[2][4] This distribution finds practical applications in modeling scenarios with inherent uniformity, such as the daily gasoline sales at a service station assumed to range uniformly between 2,000 and 5,000 gallons, where probabilities for subintervals can be directly computed as their length divided by the total interval length.[4] It is also central to Monte Carlo simulations for generating pseudo-random numbers and approximating integrals or complex distributions, as well as in quality control for variables like breaking strengths or arrival times under equal-likelihood assumptions.[1][3]Definitions
Probability density function
The continuous uniform distribution is a probability distribution defined on a closed interval [a, b] where a < b, such that every point within this interval has an equal probability of occurrence.[1][5][6] Its probability density function (PDF), denoted f(x \mid a, b), takes the following form: f(x \mid a, b) = \begin{cases} \frac{1}{b - a} & \text{if } a \leq x \leq b, \\ 0 & \text{otherwise}. \end{cases} [5][6][1] This PDF is constant and equal to \frac{1}{b - a} over the interval [a, b], reflecting the uniform nature of the distribution by assigning identical density to all values in the range.[5][6] The constant value arises from the normalization requirement for a PDF, which mandates that the integral of the density over the entire real line equals 1; for a uniform density c over an interval of length b - a, this yields c \cdot (b - a) = 1, so c = \frac{1}{b - a}.[1][6] Graphically, the PDF plots as a rectangle with base [a, b] and height \frac{1}{b - a}, dropping abruptly to zero outside this interval, which visually underscores the equal probability allocation across the support.[5][1]Cumulative distribution function
The cumulative distribution function (CDF) of a continuous uniform random variable X \sim U(a, b), where a < b, is derived by integrating the probability density function (PDF) over the appropriate range. For x < a, F(x) = 0; for a \leq x \leq b, F(x) = \int_a^x \frac{1}{b - a} \, dt = \frac{x - a}{b - a}; and for x > b, F(x) = 1.[2] The PDF is the derivative of the CDF wherever it exists.[7] This CDF is continuous and strictly increasing from 0 to 1 over the support [a, b], with a constant slope of \frac{1}{b - a} in that interval, reflecting the uniform probability density.[2] It is differentiable except possibly at the endpoints a and b, where the derivative jumps from 0 to \frac{1}{b - a} at a and from \frac{1}{b - a} to 0 at b.[8] For example, to compute the probability P(a < X \leq c) where a < c \leq b, use F(c) - F(a) = \frac{c - a}{b - a} - 0 = \frac{c - a}{b - a}.[2] The inverse CDF, or quantile function, F^{-1}(p) = a + (b - a)p for p \in [0, 1], is used to find quantiles or generate samples from the distribution via uniform random variables on [0, 1].[9]Characteristic function
The characteristic function of a random variable X following a continuous uniform distribution on the interval [a, b] with a < b is defined as \phi(t \mid a, b) = \mathbb{E}[e^{itX}], where i = \sqrt{-1} and t \in \mathbb{R}.[10][11] For t \neq 0, \phi(t \mid a, b) = \frac{e^{itb} - e^{ita}}{it(b - a)}, and \phi(0 \mid a, b) = 1. This expression arises from direct computation using the probability density function f(x) = \frac{1}{b - a} for x \in [a, b].[10][11] To derive the formula, integrate the expectation: \phi(t \mid a, b) = \int_a^b e^{itx} \cdot \frac{1}{b - a} \, dx = \frac{1}{b - a} \left[ \frac{e^{itx}}{it} \right]_a^b = \frac{e^{itb} - e^{ita}}{it(b - a)}, with the case t = 0 following by direct evaluation or continuity. The result is well-defined and finite for all real t.[10] The characteristic function is complex-valued in general, reflecting the Fourier transform nature of the definition. It exhibits a sinc-like form when expressed in terms of magnitude and phase, implying oscillatory behavior with periodic zeros in its real and imaginary parts, which stems from the bounded support of the distribution.[10][11] By the inversion theorem in probability theory, the characteristic function uniquely determines the distribution of X, as distinct characteristic functions correspond to distinct probability measures.[12]Standard uniform distribution
The standard uniform distribution, often denoted as U(0,1), is a special case of the continuous uniform distribution confined to the interval [0, 1]. It serves as a canonical form in probability theory, providing a foundational model for equally likely outcomes within a unit interval.[13] The probability density function (PDF) of the standard uniform distribution is given by f(x) = \begin{cases} 1 & 0 \leq x \leq 1 \\ 0 & \text{otherwise}. \end{cases} This constant density ensures that every point in [0, 1] has equal probability.[13] The corresponding cumulative distribution function (CDF) simplifies to F(x) = \begin{cases} 0 & x < 0 \\ x & 0 \leq x \leq 1 \\ 1 & x > 1. \end{cases} This linear form highlights the distribution's uniformity, where the probability up to any point x in the interval is simply x.[13] To obtain a uniform distribution over a general interval [a, b] where a < b, one can apply the affine transformation X = a + (b - a)U, where U \sim U(0,1). This scaling and shifting preserves the uniform properties while adjusting the support.[14] The standard uniform distribution holds central importance as the basis for many randomization techniques in simulation and Monte Carlo methods, where uniform random numbers on (0,1) are transformed to sample from other distributions. Additionally, it emerges as the output of the probability integral transform: if X is a continuous random variable with CDF F, then Y = F(X) \sim U(0,1), enabling uniformity in statistical testing and generation processes.[13][15]Properties
Moments
The moments of a continuous uniform distribution on the interval [a, b], where a < b, provide key measures of its central tendency, spread, and shape. The mean, or first raw moment, is given by \mu = \mathbb{E}[X] = \frac{a + b}{2}, which represents the midpoint of the interval due to the distribution's symmetry.[16][17] This follows from integrating x against the probability density function f(x) = \frac{1}{b - a} over [a, b].[18] The variance, or second central moment, is \sigma^2 = \frac{(b - a)^2}{12}, indicating that the spread depends solely on the interval length.[16][17] This is derived by computing the second raw moment \mathbb{E}[X^2] = \frac{b^3 - a^3}{3(b - a)} via integration and subtracting \mu^2.[18] For the standard uniform distribution on [0, 1], the variance simplifies to \frac{1}{12}.[16] Higher-order standardized moments characterize the distribution's asymmetry and tail behavior. The skewness, or standardized third central moment, is zero, reflecting the perfect symmetry around the mean.[16][17] The excess kurtosis, or standardized fourth central moment minus 3, equals -\frac{6}{5}, indicating a platykurtic shape with thinner tails than the normal distribution.[16][17] In general, the nth central moment \mu_n = \mathbb{E}[(X - \mu)^n] is computed by expanding (X - \mu)^n and integrating against the PDF, or equivalently using the binomial theorem on raw moments. For odd n, \mu_n = 0 due to symmetry. For even n = 2k, \mu_{2k} = \frac{(b - a)^{2k}}{2^{2k} (2k + 1)}, derived from the raw moments \mathbb{E}[X^m] = \frac{b^{m+1} - a^{m+1}}{(m+1)(b - a)} for m = 0, 1, \dots, 2k.[16] For the standard uniform on [0, 1], these simplify further, with \mu_2 = \frac{1}{12} and \mu_4 = \frac{1}{80}.[16] The moment-generating function can also yield these moments by differentiation, though direct integration is often more straightforward for this distribution.[17]Order statistics
Let X_1, \dots, X_n be independent and identically distributed random variables from the continuous uniform distribution on the interval [a, b], where a < b. The order statistics are denoted X_{(1)} \leq X_{(2)} \leq \dots \leq X_{(n)}.[19] The joint probability density function of the order statistics X_{(1)}, \dots, X_{(n)} is f_{X_{(1)}, \dots, X_{(n)}}(x_1, \dots, x_n) = n! \left( \frac{1}{b-a} \right)^n, \quad a < x_1 < x_2 < \dots < x_n < b. This follows from the general formula for order statistics of i.i.d. continuous random variables, specialized to the uniform density.[19] The marginal distribution of the sample minimum X_{(1)} has PDF f_{X_{(1)}}(x) = \frac{n}{b-a} \left( \frac{b - x}{b - a} \right)^{n-1}, \quad a < x < b. Equivalently, X_{(1)} \stackrel{d}{=} a + (b - a) U_{(1)}, where U_{(1)} follows a Beta(1, n) distribution on [0, 1].[19][20] The marginal distribution of the sample maximum X_{(n)} has PDF f_{X_{(n)}}(x) = \frac{n}{b-a} \left( \frac{x - a}{b - a} \right)^{n-1}, \quad a < x < b. Equivalently, X_{(n)} \stackrel{d}{=} a + (b - a) U_{(n)}, where U_{(n)} follows a Beta(n, 1) distribution on [0, 1].[19][20] The sample range is defined as R = X_{(n)} - X_{(1)}. For the standard uniform on [0, 1], the PDF of R is f_R(r) = n(n-1) r^{n-2} (1 - r), \quad 0 < r < 1. For the general uniform on [a, b], R \stackrel{d}{=} (b - a) Z, where Z has the above distribution on [0, 1], yielding f_R(r) = \frac{n(n-1)}{b-a} \left( \frac{r}{b-a} \right)^{n-2} \left( 1 - \frac{r}{b-a} \right), \quad 0 < r < b - a. The expected value is E[R] = (b - a) \frac{n-1}{n+1}.[20] The sample midrange is M = \frac{X_{(1)} + X_{(n)}}{2}. Its PDF for i.i.d. continuous uniforms is obtained via the joint distribution of the minimum and maximum: f_M(m) = n \int_{-\infty}^{m} [F(2m - x) - F(x)]^{n-1} f(x) \, dx, where F and f are the CDF and PDF of the uniform, respectively. For the standard uniform on [0, 1], this simplifies to a piecewise form reflecting symmetry around 0.5, with M concentrating near the population mean as n increases.[20] The spacings are the differences between consecutive order statistics, augmented by the endpoints: D_1 = X_{(1)} - a, D_i = X_{(i)} - X_{(i-1)} for i = 2, \dots, n, and D_{n+1} = b - X_{(n)}. The normalized spacings \left( \frac{D_1}{b-a}, \dots, \frac{D_{n+1}}{b-a} \right) follow a Dirichlet(1, 1, \dots, 1) distribution (with n+1 parameters of 1), which is uniform on the (n+1)-dimensional simplex \{ (s_1, \dots, s_{n+1}) : s_i > 0, \sum s_i = 1 \}. This property underlies applications of uniform order statistics in renewal processes, Bayesian nonparametrics, and simulation of compositional data.[20]Entropy
The differential entropy of a continuous random variable X following a uniform distribution on the interval [a, b] is calculated as h(X) = -\int_{-\infty}^{\infty} [f(x)](/page/F/X) \ln [f(x)](/page/F/X) \, dx, where f(x) = \frac{1}{b-a} for x \in [a, b] and $0 otherwise. Substituting the probability density function yields h(X) = -\int_{a}^{b} \frac{1}{b-a} \ln \left( \frac{1}{b-a} \right) \, dx = \ln(b - a), measured in nats (using the natural logarithm).[21][22] This value represents the expected amount of uncertainty in X, and for distributions supported within a fixed interval [a, b], the uniform distribution achieves the maximum possible differential entropy, as any deviation from uniformity reduces the entropy due to the non-negativity of the Kullback-Leibler divergence from the uniform density.[21][23] For the standard uniform distribution on [0, 1], the entropy simplifies to h(U) = \ln(1 - 0) = 0.[21] This zero value highlights a key property of differential entropy: unlike discrete entropy, it can be non-positive, reflecting the relative nature of uncertainty in continuous spaces where the uniform on a unit interval serves as a baseline.[21]Extensions to general spaces
The continuous uniform distribution extends naturally to compact subsets of Euclidean space where a suitable measure is defined. For a compact set K \subset \mathbb{R}^n with finite positive Lebesgue measure \lambda(K), the uniform distribution is the probability measure absolutely continuous with respect to Lebesgue measure, having constant density f(\mathbf{x}) = 1 / \lambda(K) for \mathbf{x} \in K and zero elsewhere; this normalization ensures the integral over K equals 1.[24] On lower-dimensional compact manifolds embedded in \mathbb{R}^n, such as spheres or simplices, the uniform distribution is instead defined with respect to the induced surface (Hausdorff) measure, with constant density $1 / \mu(K) where \mu(K) is the total surface measure of K.[25] This framework preserves the core idea of equal probability allocation across the space, generalizing the standard uniform on an interval as the simplest one-dimensional case. A prominent example is the uniform distribution on the unit ball B^n = \{\mathbf{x} \in \mathbb{R}^n : \|\mathbf{x}\| \leq 1\}, where the density is constant at $1 / v_n with respect to Lebesgue measure, and v_n = \pi^{n/2} / \Gamma(n/2 + 1) is the volume of the unit ball.[26] For the unit sphere S^{n-1} = \{\mathbf{x} \in \mathbb{R}^n : \|\mathbf{x}\| = 1\}, the uniform distribution is supported on the surface with respect to the (n-1)-dimensional Hausdorff measure, normalized by the surface area s_{n-1} = 2 \pi^{n/2} / \Gamma(n/2); it arises as the distribution of a standard Gaussian vector in \mathbb{R}^n conditioned on (or normalized by) its Euclidean norm equaling 1.[27] These examples highlight volume or surface normalization to achieve uniformity. For symmetric compact sets like the unit ball or sphere, the uniform distribution exhibits rotational invariance: if U has the uniform distribution on such a set and Q is an orthogonal matrix (rotation), then QU has the same distribution as U.[28] This property follows from the symmetry of the underlying measure under the orthogonal group and underpins applications in directional statistics and random vector generation. On the standard (n-1)-simplex \Delta^{n-1} = \{\mathbf{x} \in \mathbb{R}^n : x_i \geq 0, \sum_{i=1}^n x_i = 1\}, the uniform distribution corresponds precisely to the Dirichlet distribution with all shape parameters equal to 1, which has density (n-1)! (constant) with respect to the (n-1)-dimensional Lebesgue measure on the simplex; this equivalence arises because the Dirichlet(1, \dots, 1) is the unique distribution invariant under permutations of coordinates that integrates to 1 over \Delta^{n-1}.[29]Related distributions
Discrete uniform distribution
The discrete uniform distribution is a fundamental probability distribution defined over a finite set of consecutive integers, where each possible outcome is equally likely. For a random variable X taking values in the set \{0, 1, \dots, n\}, the probability mass function assigns probability p(k) = \frac{1}{n+1} to each integer k in that set, with n being a non-negative integer./05%3A_Special_Distributions/5.22%3A_Discrete_Uniform_Distributions) More generally, it can be defined over any finite set of integers \{a, a+1, \dots, b\} with a \leq b, where the probability is \frac{1}{b-a+1} for each value, reflecting scenarios with a known, finite number of equally probable discrete outcomes, such as the result of rolling a fair die.[30] The moments of the discrete uniform distribution differ slightly from those of its continuous counterpart due to the discrete support. For X on \{0, 1, \dots, n\}, the expected value (mean) is E[X] = \frac{n}{2}, and the variance is \text{Var}(X) = \frac{n(n+2)}{12}./05%3A_Special_Distributions/5.22%3A_Discrete_Uniform_Distributions) For large n, the variance approximates \frac{(n+1)^2}{12}, which, when scaled appropriately (e.g., by dividing by n+1), aligns closely with the continuous uniform's variance structure.[31] As n \to \infty, the discrete uniform distribution, when suitably scaled and normalized, converges in distribution to the continuous uniform distribution over the corresponding interval, bridging the gap between discrete and continuous models.[32] This convergence highlights how the discrete uniform serves as a natural discrete analog to the continuous uniform, particularly useful when the number of outcomes is finite but large enough that continuity provides a reasonable approximation.[33] In practice, the discrete uniform is employed for modeling situations with exact finite support and equal likelihoods, such as sampling without replacement from a small population, whereas the continuous uniform is preferred for approximating infinitely divisible outcomes or when the granularity of discreteness is negligible.[30]Multivariate uniform distribution
The multivariate uniform distribution extends the concept of the continuous uniform distribution to multiple dimensions, specifically over a hyperrectangle defined as the Cartesian product \mathcal{R} = [a_1, b_1] \times \cdots \times [a_d, b_d], where a_i < b_i for each dimension i = 1, \dots, d.[34] The joint probability density function of a d-dimensional random vector \mathbf{X} = (X_1, \dots, X_d) following this distribution is constant over \mathcal{R}: f(\mathbf{x}) = \prod_{i=1}^d \frac{1}{b_i - a_i}, \quad \mathbf{x} \in \mathcal{R}, and f(\mathbf{x}) = 0 otherwise.[34] This form arises as the product of the individual univariate uniform densities, ensuring the total probability integrates to 1, with the normalizing constant equal to the reciprocal of the hyperrectangle's volume V = \prod_{i=1}^d (b_i - a_i).[34] Because the joint density factors into the product of the marginal densities, the components X_1, \dots, X_d are mutually independent, with each X_i distributed uniformly on [a_i, b_i]./03%3A_Distributions/3.04%3A_Joint_Distributions) The marginal distribution of any subset of components, such as X_{(S)} = (X_i)_{i \in S} for S \subseteq \{1, \dots, d\}, is uniform over the projection \prod_{i \in S} [a_i, b_i], obtained by integrating the joint density over the complementary coordinates. Likewise, conditional distributions, such as that of X_{(S)} given the values of the remaining components, are uniform over the resulting conditional hyperrectangle within \mathcal{R}. When d=1, this reduces to the univariate continuous uniform distribution on [a_1, b_1].[2]Parameter estimation
Maximum likelihood estimation
The maximum likelihood estimation (MLE) for the endpoints a and b of the continuous uniform distribution U(a, b) is derived from a random sample x_1, \dots, x_n of independent and identically distributed observations. The likelihood function is given by L(a, b \mid x_1, \dots, x_n) = \left( \frac{1}{b - a} \right)^n \mathbf{1}_{\{a \leq \min_i x_i, \max_i x_i \leq b\}}, where \mathbf{1} is the indicator function, and L = 0 otherwise.[35] This likelihood is maximized when the interval [a, b] is as short as possible while containing all sample points, yielding the MLEs \hat{a} = \min_i x_i and \hat{b} = \max_i x_i.[35] These estimators are biased. For \hat{a}, the expected value is E[\hat{a}] = a + \frac{b - a}{n + 1}, which exceeds a and indicates an upward bias; for \hat{b}, E[\hat{b}] = b - \frac{b - a}{n + 1}, indicating a downward bias.[19] The MLEs are consistent as n \to \infty, converging in probability to the true parameters, but they are not asymptotically efficient due to the non-regular nature of the model, where the support depends on the parameters and standard regularity conditions for maximum likelihood theory fail.[36]Method of moments estimation
The method of moments estimation for the continuous uniform distribution U(a, b) equates the first two population moments to their sample counterparts to obtain point estimates for the parameters a and b. The population mean is \mu = (a + b)/2 and the population variance is \sigma^2 = (b - a)^2 / 12.[37] The sample mean \bar{x} = n^{-1} \sum_{i=1}^n x_i provides an unbiased estimator for the midpoint (a + b)/2, as \mathbb{E}[\bar{x}] = \mu.[38] Setting \bar{x} = (a + b)/2 yields the midpoint estimate \hat{m} = \bar{x}. For the variance, the sample second moment about the origin is \hat{\mu}_2 = n^{-1} \sum_{i=1}^n x_i^2, and the sample variance is estimated as \hat{\sigma}^2 = \hat{\mu}_2 - \bar{x}^2. Equating this to (b - a)^2 / 12 gives (b - a)^2 = 12 \hat{\sigma}^2, so the range estimate is \widehat{(b - a)} = \sqrt{12 \hat{\sigma}^2} = 2 \sqrt{3 \hat{\sigma}^2}.[37] Combining the midpoint and range estimates produces the parameter estimators \hat{a} = \bar{x} - \sqrt{3 \hat{\sigma}^2} and \hat{b} = \bar{x} + \sqrt{3 \hat{\sigma}^2}.[38] These estimators have desirable properties for the midpoint but limitations for the endpoints. The midpoint estimator \hat{m} is unbiased, reflecting the unbiasedness of the sample mean. However, the range estimator \widehat{(b - a)} is biased downward because \mathbb{E}[\hat{\sigma}^2] = ((n-1)/n) \sigma^2 < \sigma^2, and the concave square root function further contributes to underestimation via Jensen's inequality, leading to \mathbb{E}[\hat{a}] > a and \mathbb{E}[\hat{b}] < b on average.[39]Confidence intervals and hypothesis testing
Intervals for endpoints
The maximum likelihood estimators for the endpoints a and b of the continuous uniform distribution on [a, b] are the sample minimum \hat{a} = X_{(1)} and sample maximum \hat{b} = X_{(n)}, respectively, based on a random sample of size n.[40] For the lower endpoint a, the pivotal quantity Q = \frac{X_{(1)} - a}{b - a} follows a Beta(1, n) distribution.[41] When b is unknown, an approximate (1 - \alpha) \times 100\% confidence interval for a substitutes the maximum likelihood estimate \hat{b} for b, yielding the interval \left[ X_{(1)} - \frac{\hat{b} - X_{(1)}}{n}, X_{(1)} \right]. This approximation leverages the expected value of the pivotal quantity, E[Q] = \frac{1}{n+1} \approx \frac{1}{n} for large n, to adjust for bias in the endpoint estimate. The coverage probability is exact under the Beta distribution when b is known but approximate otherwise, approaching the nominal level as n increases.[42] Symmetrically, for the upper endpoint b, the pivotal quantity \frac{b - X_{(n)}}{b - a} also follows a Beta(1, n) distribution. The corresponding approximate (1 - \alpha) \times 100\% confidence interval is \left[ X_{(n)}, X_{(n)} + \frac{X_{(n)} - X_{(1)}}{n} \right], with analogous properties regarding coverage based on the Beta distribution.[41][42] Joint confidence intervals for the pair (a, b) can be constructed using the sample range R = X_{(n)} - X_{(1)} or the midrange M = \frac{X_{(1)} + X_{(n)}}{2}. The normalized range \frac{R}{b - a} follows a Beta(n-1, 2) distribution, enabling exact confidence intervals for the interval length b - a via its quantiles; for example, a one-sided upper bound is \frac{R}{q_{\alpha}}, where q_{\alpha} is the \alpha-quantile of Beta(n-1, 2), ensuring P(b - a < \frac{R}{q_{\alpha}}) = 1 - \alpha. The midrange M provides a location estimate for the center \frac{a + b}{2}, and combining it with a length interval from the range yields a joint region with coverage derived from the joint distribution of the order statistics, which has density n(n-1)(u - v)^{n-2} for $0 < v < u < 1 after normalization to the unit interval. These joint constructions achieve exact coverage probabilities based on the underlying Beta distributions of the transformed order statistics.[41]Tests for uniformity
To determine whether a sample of data follows a continuous uniform distribution, several goodness-of-fit tests compare the observed data to the expected uniform cumulative distribution function (CDF), typically after standardizing the sample to the interval [0,1] for simplicity. These tests are nonparametric or semi-parametric and are designed to detect deviations from uniformity under the null hypothesis that the data are i.i.d. from Uniform(a, b) with known or estimated endpoints.[43] The Kolmogorov-Smirnov (KS) test evaluates the supremum deviation between the empirical CDF F_n(x) and the theoretical uniform CDF F(x) = x on [0,1]. The test statistic is defined as D_n = \sup_{x \in [0,1]} |F_n(x) - x|, where F_n(x) is the proportion of observations less than or equal to x. Under the null hypothesis, the distribution of \sqrt{n} D_n converges to the Kolmogorov distribution, with critical values tabulated for significance levels such as 5% (approximately 1.36 for large n). This test is distribution-free and sensitive to discrepancies anywhere in the CDF, though it has reduced power near the tails.[43][44] The chi-squared goodness-of-fit test adapts the Pearson chi-squared statistic for continuous data by binning the sample into k equal-probability intervals under uniformity, yielding expected frequencies of n/k in each bin for sample size n. The test statistic is \chi^2 = \sum_{i=1}^k \frac{(O_i - E_i)^2}{E_i}, which asymptotically follows a chi-squared distribution with k-1 - p degrees of freedom, where p is the number of estimated parameters (p=0 for known endpoints, p=2 otherwise) and k should be chosen such that expected frequencies exceed 5 to ensure validity. This test is computationally simple but requires careful binning, as the choice of k affects power, and it is less sensitive to tail deviations compared to EDF-based tests.[45][46] The Anderson-Darling (AD) test enhances the Cramér-von Mises statistic by incorporating a weight function that emphasizes the tails of the distribution, making it more powerful for detecting departures from uniformity in extreme regions. For standardized uniform data, the test statistic is A_n^2 = -n - \frac{1}{n} \sum_{i=1}^n (2i - 1) \left[ \ln U_{(i)} + \ln (1 - U_{(n+1-i)}) \right], where U_{(i)} are the ordered uniform observations; under the null, A_n^2 follows a known asymptotic distribution with tabulated critical values (e.g., 2.492 for 5% significance at large n). This weighting, $1/[F(x)(1-F(x))], allocates more importance to observations near 0 and 1.[47][48] Power studies indicate that the AD test generally outperforms the KS and chi-squared tests against common alternatives to uniformity, such as the normal distribution (after truncation or scaling to [0,1]) and the triangular distribution, due to its tail sensitivity. The chi-squared test exhibits moderate power against central deviations but lower overall against smooth alternatives like the triangular, while KS provides balanced but conservative performance. Selection of the test depends on the suspected alternative and sample size, with AD recommended for tail-focused hypotheses.[49]Applications
Sampling and simulation
The continuous uniform distribution is fundamental in sampling and simulation, particularly as a building block for generating random variates from more complex distributions via Monte Carlo methods. The standard uniform distribution on the interval [0,1] serves as a versatile generator for simulating variables from arbitrary continuous distributions.[50] A key technique is the inverse cumulative distribution function (CDF) method, which transforms a uniform random variable into one following any target distribution with invertible CDF F. Specifically, if U \sim \mathcal{U}(0,1), then X = F^{-1}(U) has CDF F, ensuring P(X \leq x) = F(x) for all x. This method is general and efficient when F^{-1} can be computed analytically or numerically.[50] In rejection sampling, the uniform distribution frequently acts as a simple proposal distribution to sample from target densities f that are bounded and supported on a finite interval. Candidates Y are drawn from a uniform proposal g, and accepted with probability f(Y)/(M g(Y)), where M \geq \sup f/g; this yields exact samples from f while controlling acceptance rates through the choice of M. Uniform proposals are ideal for targets with compact support, minimizing computational waste in low dimensions.[51] Importance sampling employs the uniform as a base (proposal) measure to estimate expectations \mathbb{E}_p[h(X)] = \int h(x) p(x) \, dx under a target density p, by drawing from uniform q and reweighting via w(x) = p(x)/q(x), yielding the unbiased estimator \frac{1}{n} \sum_{i=1}^n h(X_i) w(X_i) for X_i \sim q. This approach reduces variance compared to crude Monte Carlo when q approximates p, and uniforms provide a straightforward, bounded alternative for integrals over finite domains.[52] An illustrative application is Monte Carlo integration, where uniforms approximate definite integrals \int_a^b f(x) \, dx by sampling X_i \sim \mathcal{U}(a,b) and computing (b-a) \frac{1}{n} \sum_{i=1}^n f(X_i); this estimator is consistent and asymptotically normal, with variance decreasing as O(1/n), making it effective for high-dimensional or irregular f.[53]Physical and engineering models
In analog-to-digital (A/D) conversion, quantization error arises when a continuous analog signal is mapped to discrete digital levels, and this error is commonly modeled as additive uniform noise distributed over the quantization interval. For a uniform quantizer with step size Δ (the least significant bit, or LSB), the error is uniformly distributed between -Δ/2 and +Δ/2, assuming the input signal spans the levels uniformly and the quantizer has many levels. The variance of this noise, which quantifies its power, is given by \frac{\Delta^2}{12}; for the unit interval where Δ = 1, the variance simplifies to \frac{1}{12}. This model facilitates signal-to-noise ratio (SNR) analysis in digital systems, treating the error as white noise uncorrelated with the input signal.[54] In signal processing, phase noise in oscillators and communication systems is often modeled using a uniform distribution for the phase perturbations, particularly when representing random phase fluctuations in complex noise processes. For instance, in optical coherence tomography (OCT) systems, the noise phase angle is approximated as uniformly distributed over (-\pi, \pi] to capture the random deviations from the ideal phase, enabling accurate prediction of spectral broadening and system performance degradation. This uniform assumption holds for zero-mean, independent in-phase and quadrature components in complex Gaussian noise, leading to a circularly symmetric distribution where phase is equally likely across the interval. Such models are essential for designing robust receivers and mitigating bit error rates in phase-sensitive applications like radar and wireless communications.[55] Random positioning in engineering control systems frequently employs a uniform distribution to model stochastic orientation or location changes, as seen in random positioning machines (RPMs) used for simulating microgravity environments. These devices rotate samples continuously in random directions via servo-controlled motors, with angular positions drawn uniformly from specified intervals to average out gravitational effects over time and mimic weightlessness for physical experiments. The uniform distribution ensures equitable coverage of the positional space, facilitating precise control algorithms that maintain randomness while minimizing bias in orientation. This approach is critical in aerospace engineering for testing material behaviors under altered gravity without spaceflight.[56] In very-large-scale integration (VLSI) design, wire lengths between circuit components are approximated using stochastic models for gate placements to estimate interconnect costs early in the layout process. Assuming gates are stochastically placed across socket positions in a chip array, the interconnect length distribution follows from Rent's rule, which relates module complexity to wiring requirements via parameters like the Rent exponent. This approximation simplifies the calculation of average wire lengths through probabilistic integrals over gate pairs, reducing estimation errors by up to 50% compared to prior non-stochastic methods and aiding optimization of power, performance, and area (PPA) metrics.[57]Economic and decision theory examples
In Bayesian analysis within economics and decision theory, the continuous uniform distribution serves as a noninformative prior for parameters with unknown bounds, representing subjective ignorance or equal likelihood across possible values. For instance, when estimating an unknown upper bound in a uniform demand distribution for inventory decisions, a uniform prior on the parameter leads to a Pareto posterior, enabling updates based on observed data to inform optimal ordering policies.[58][59] This approach is particularly useful in economic models where historical data is scarce, allowing decision-makers to incorporate prior beliefs of uniformity before evidence refines estimates of parameters like demand ceilings. In auction theory, simple models often assume bidders' private valuations are independently drawn from a continuous uniform distribution to derive equilibrium bidding strategies. Under this setup, risk-neutral bidders in a first-price auction shade their bids below their valuations, with the symmetric Nash equilibrium bid function given by b(v) = \frac{n-1}{n} v for n bidders and valuations uniform on [0,1], illustrating how uniformity simplifies revenue equivalence across auction formats.[60] Such models underpin analyses of procurement and spectrum auctions, where uniform assumptions highlight the impact of bidder numbers on expected seller revenue. Inventory management models in operations economics frequently model demand as continuous uniform over a period to capture uncertainty in new or seasonal products without prior sales data. In the (Q, r) reorder point system, uniform demand between minimum and maximum values—often assuming a lower bound of zero—yields closed-form expressions for optimal lot sizes and service levels, minimizing costs under lead-time variability.[61] For example, with maximum demand of 100 units and lead-time of 10 days, the model suggests an optimal order quantity around 1,145 units, providing a practical baseline for economic planning until more data accumulates. A representative example in decision theory involves an investor choosing between assets under uniform beliefs about future returns, where the continuous uniform distribution models equal probability across possible outcomes to compute expected utility. If returns are uniform on [a, b], the decision maximizes \mathbb{E}[u(R)], with the mean \frac{a+b}{2} establishing the baseline utility under risk aversion, guiding choices like portfolio allocation in uncertain markets.[62] This framework underscores how uniform beliefs facilitate straightforward expected utility calculations in economic choices under ambiguity.Computational aspects
Random variate generation
Generating pseudo-random variates from the continuous uniform distribution on [0,1) is fundamental in computational simulations, relying on deterministic algorithms that produce sequences appearing statistically random and uniformly distributed.[63] One of the simplest and most widely used methods is the linear congruential generator (LCG), defined by the recurrence relationZ_{n+1} = (a Z_n + c) \mod m,
where Z_0 is the initial seed (an integer between 0 and m-1), m > 0 is the modulus, a is the multiplier (0 < a < m), and c is the increment (0 ≤ c < m). The output is then scaled to the unit interval as U_n = Z_n / m, yielding a sequence U_n intended to mimic independent uniform random variables on [0,1).[63][64] The period of an LCG, the length before the sequence repeats, is at most m; full-period LCGs achieve exactly m distinct values under the Hull-Dobell theorem conditions: c and m coprime, a-1 divisible by all prime factors of m, a-1 divisible by 4 if m is divisible by 4.[63] Uniformity is assessed via statistical tests such as the chi-squared test, Kolmogorov-Smirnov test, or spectral tests to verify that the sequence lacks detectable patterns and approximates the uniform distribution.[63][65] To generate variates on a general interval [a, b] with a < b, scale the standard uniform U \sim \text{Uniform}(0,1) via the linear transformation X = a + (b - a) U, which preserves uniformity due to the affine property of the distribution.[66] For improved statistical properties over LCGs, which often suffer from short periods and correlations in higher dimensions, the Mersenne Twister algorithm provides a high-quality alternative. Developed by Matsumoto and Nishimura, it uses a twisted generalized feedback shift-register structure to generate a sequence with period $2^{19937} - 1 and 623-dimensional equidistribution, ensuring excellent uniformity for the most significant bits when scaled to [0,1).[67] This makes it suitable for demanding applications requiring long, high-quality uniform sequences.[67]
Numerical evaluation of functions
The probability density function (PDF) and cumulative distribution function (CDF) of the continuous uniform distribution on the interval [a, b] admit closed-form expressions that enable efficient numerical evaluation. The PDF is defined as f(x) = \frac{1}{b - a} for a \leq x \leq b and f(x) = 0 otherwise, while the CDF is F(x) = 0 for x < a, F(x) = \frac{x - a}{b - a} for a \leq x \leq b, and F(x) = 1 for x > b.[11] In computational software, these functions are implemented using the closed-form formulas, with attention to endpoint evaluation to mitigate floating-point arithmetic errors, such as ensuring F(a) = 0 and F(b) = 1 precisely. For instance, Python's SciPy library provides theuniform.pdf and uniform.cdf methods in the scipy.stats module, which compute the PDF and CDF directly for a scaled and shifted uniform on [ \text{loc}, \text{loc} + \text{scale} ] , returning values clamped at the boundaries.[68] Similarly, R's stats package implements dunif for the PDF and punif for the CDF (by default, the left-tail probability P(X \leq x)), applying the formulas over the specified [\min, \max] interval and handling cases where \min = \max by returning NaN.[69]
The characteristic function \phi(t) of the continuous uniform distribution on [a, b] is given by \phi(t) = \frac{e^{i t b} - e^{i t a}}{i t (b - a)} for t \neq 0, with \phi(0) = 1.[11] This expression can equivalently be written using the sinc function as \phi(t) = e^{i t (a + b)/2} \cdot \operatorname{sinc}\left( \frac{(b - a) t}{2} \right), where \operatorname{sinc}(u) = \frac{\sin(u)}{u} for u \neq 0 and \operatorname{sinc}(0) = 1.[70] Numerical evaluation involves complex exponential computations, but the singularity at t = 0 is avoided by directly assigning \phi(0) = 1, leveraging the function's continuity; for small |t|, the sinc form enhances stability by avoiding cancellation in the numerator.[70]
The raw moments of the continuous uniform distribution also possess closed-form expressions, such as the k-th moment E[X^k] = \frac{b^{k+1} - a^{k+1}}{(k+1)(b - a)}.[11] However, in general cases—such as verifying analytical results, extending to non-integer orders, or integrating against more complex weight functions—numerical quadrature can approximate these moments by evaluating the integral E[X^k] = \int_a^b x^k f(x) \, dx. Gaussian quadrature rules, which exactly integrate polynomials up to degree $2n - 1 using n points, are particularly effective for this bounded interval after a suitable transformation (e.g., to [-1, 1]), providing high accuracy with few evaluations.[71]