Contact

RANDDISCRETE Function (Gnumeric)

Statistical Intermediate Gnumeric

Draw a numeric outcome from a finite distribution in Gnumeric using equal or explicit probabilities, with deterministic controls and probability validation.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

RANDDISCRETE returns one numeric outcome from a supplied finite list. Optional probabilities let you model unequal chances; omitting them gives equal probabilities across the collected outcomes. A single random result is not a distribution summary, and a short sample cannot verify that probabilities are implemented accurately.

Syntax and input requirements

=RANDDISCRETE(val_range,[prob_range])

val_range supplies possible numeric outcomes. prob_range supplies corresponding nonnegative probabilities and is optional. In the inspected source, text, Boolean and blank entries are ignored by numeric collectors. Keep complete numeric lists with aligned entries; ignored cells can disrupt your intended correspondence.

The collected outcome and probability counts must match. Negative probabilities or a probability total differing from1 by more than10^-10 lead to #NUM! in the retained implementation. That tolerance is an implementation detail, not a reason to leave an incorrectly normalized model. Array constants are used in the official examples and are accepted in the bounded tests despite the help’s broad “range” wording.

Deterministic fixtures for a random function

=RANDDISCRETE({7}) is expected to return 7 because the only possible outcome is 7. =RANDDISCRETE({10,20},{1,0}) is expected to return 10 because its probability is 1. These are reproducible control cases; they do not claim that a general multi-outcome call repeats the same draw.

For error checks, =RANDDISCRETE({10,20},{0.2,0.2}) is expected to return #NUM! because the total probability is 0.4. =RANDDISCRETE({10,20},{-0.1,1.1}) is expected to return #NUM! because a probability is negative even though the total is 1.

Practical scenario and independent model

For a synthetic demand scenario, put 10,20,40 in A2:A4 and0.2,0.5,0.3 in B2:B4. =RANDDISCRETE(A2:A4,B2:B4) draws one of those demand values. Its theoretical expected value is10×0.2 +20×0.5 +40×0.3 =24. A particular draw is still10,20 or40; the function does not return24 merely because that is the expectation.

Duplicates in the outcome list represent repeated entries, so their probability mass combines at the same observed value. Equal probability by position is not equal probability over distinct values if the list contains duplicates.

Advanced use and troubleshooting

Random functions can change on recalculation. Preserve an approved simulation realization as values when reproducibility is required, and keep the original model separately. This function has no seed argument, so do not promise identical draws across sessions or software versions.

Use enough simulated observations and appropriate diagnostics if investigating a model, but do not treat the deterministic control cases here as a statistical certification of the random generator. Validate input probabilities independently and distinguish parameter errors from normal random variation.

NEWS introduces RANDDISCRETE in 1.1.7 and records a crash fix in 1.9.4. The current guide uses retained official 1.12.62 source plus bounded1.12.57 controls. No broad distribution-quality or cryptographic-randomness claim is made, and the last functioning release is not established.

Native verification

The native 1.12.57 run returned 7 and 10 for the deterministic controls and #NUM! for both malformed-probability fixtures. These tests do not establish empirical frequencies for the general three-outcome example.