RANDUNIFORM Function (Gnumeric)
Use Gnumeric RANDUNIFORM for bounded simulation, distinguish variable draws from deterministic mapping controls and account for volatility and finite precision.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: =RANDUNIFORM(2,6) produces a changing draw using the source transformation 2+4*u. No particular sample value is promised. Equal finite bounds, such as =RANDUNIFORM(5,5), give the constant 5.
Availability and evidence
- Introduction: Gnumeric 1.1.6. NEWS explicitly lists RANDUNIFORM among new random-distribution functions.
- Source support: Registered in the Gnumeric 1.12.62 plugin. No retirement is established. The last functioning application version is unverified for this guide.
- Evidence dates: Official source was retained October 13–14, 2026 and reviewed October 15. Independent exact-rational and high-precision mathematical checks are reference calculations. No native Gnumeric, headless application, GUI or random-generator execution was performed.
Exact syntax and implementation
=RANDUNIFORM(a,b)
Both required numeric arguments define the lower and upper limits. The callback rejects a>b with #NUM!. Otherwise it evaluates a+random_01()*(b-a). Equal bounds are allowed, producing a degenerate constant when the finite arithmetic is well behaved.
The ideal continuous uniform model gives equal probability to subintervals of equal length. Its mean is (a+b)/2 and variance is (b-a)^2/12. These are theoretical distribution properties, not assertions that a small generated sample has exactly that average or spread.
The source random_01 helper constructs a finite-resolution value from zero up to, but below, one. That does not guarantee that the final rounded expression can never equal b. Finite multiplication and addition can round an upper-end result to the bound. Do not use the formula as a strict endpoint-exclusion check, and do not confuse a rounded continuous draw with a uniformly selected integer.
Reproducible worksheet with honest expectations
Create UniformDraws. Put lower bound 2 in F2 and upper bound 6 in G2. In A2 enter =RANDUNIFORM($F$2,$G$2) and fill through A11. These cells contain variable draws, so there is no fixed ten-number answer key.
For this modest finite interval, each result should remain within the bounded scale from 2 to 6, allowing the rounding endpoint noted above. In B2 enter =(A2-$F$2)/($G$2-$F$2) and fill down. B expresses each result on the unit scale. It is a diagnostic transformation of the same draw, not a second independent random value.
In a copy, change both bounds to 5 and inspect A. Every A result has the deterministic reference value 5. The normalized B formula now divides by zero because its denominator is b-a; remove or bypass that diagnostic for equal bounds. This does not make RANDUNIFORM(5,5) invalid.
Deterministic and domain controls
| Formula | Independent reference or source contract |
|---|---|
=RANDUNIFORM(5,5) |
5 |
=RANDUNIFORM(-2,-2) |
-2 |
=RANDUNIFORM(0,0) |
0 |
=RANDUNIFORM(6,2) |
#NUM! |
=RANDUNIFORM(2,6) |
2+4*u; variable draw |
=RANDUNIFORM(100,120) |
100+20*u; variable draw |
=RANDUNIFORM(-3,1) |
-3+4*u; variable draw |
The constant and error controls come from the callback. The nonconstant rows specify the transformation and intended range rather than fabricated native outputs. No random generator, native application or seed sequence was executed for this guide.
Advanced: audit the transformation with supplied unit values
On MappingCheck, put hypothetical unit inputs 0,0.25,0.5,0.75 in D2:D5. In E2 use =2+4*D2 and fill down. The exact values are 2,3,4,5. These are deliberately supplied controls for the transformation; they are not a recorded or predicted RANDUNIFORM sample.
With hypothetical interval 100 to 120, the same inputs map to 100,105,110,115 through =100+20*D2. The model mean is 110 and variance 100/3, about 33.333333333333. Changing the interval scales and shifts every mapped value; it does not change the supplied unit inputs into observations.
Advanced: separate a sample average from an expectation
For the ideal 2-to-6 model, the mean is 4 and variance 4/3. Under an explicit independent-draw model, the average of 100 draws has variance 1/75 and standard deviation about 0.115470053838. This describes variability of an average across hypothetical repeated samples; it does not guarantee an observed average is within a fixed distance of four.
Reuse matters. If X has the 100-to-120 model, two independent copies have sum mean 220 and variance 200/3. The expression 2*X has the same mean but variance 400/3, because the same draw is used twice. Referencing one random cell twice and writing two random formulas represent different modeling intentions. This guide does not certify the actual generator’s independence or correlation properties.
Volatility and reproducibility
The function is registered as volatile in the examined source. Recalculation can change its output, and it has no seed argument. Exact trigger timing, workbook-save recalculation and reproducibility across machines were not tested. Record the generated values and the parameters used if an audit requires a stable sample; a workbook containing only volatile formulas is not a frozen observation table.
Do not interpret a changing result as a calculation error. Conversely, repeated or nearly equal values in a short sample are not proof of a defect. This is a simulation function, not a certified source for passwords, cryptographic keys or fairness-sensitive allocation.
Troubleshooting and boundaries
Check the order of a and b before applying arithmetic to a #NUM! result. Use moderate finite bounds: extreme subtraction b-a can overflow even when both endpoints are individually finite. Source error values propagate through argument evaluation. Locale-dependent text parsing, extreme numerical behavior, exact UI recalculation and exported workbook behavior remain unverified.
For integer outcomes, simple rounding changes probabilities at boundary buckets and is not a substitute for a separately verified discrete model. Choose the distribution from the intended experiment rather than from convenient output formatting.