RANDBINOM in Calligra Sheets: Sample Small Binomial Counts Safely
Learn Calligra Sheets RANDBINOM with exact arguments, reproducible inputs, independently checked results and implementation-specific cautions.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer
RANDBINOM(p; trials) is intended to return a binomial count. Use a modest nonnegative whole trial count and an interior probability for the sampled examples here. The inspected implementation has an unsafe p=1 recurrence, so the mathematical all-success boundary is not a reliable function call to use in this build.
Syntax and parameters
=RANDBINOM(p; trials)
The registration requires two arguments, despite the abbreviated one-argument syntax/example in the KDE RANDBINOM entry. The first argument is converted to a floating probability, the second to an integer trial count. Explicit guards return #VALUE! when p<0, p>1 or the converted trial count is negative.
The algorithm starts with probability mass (1−p)^trials and accumulates successive masses until a sampled uniform threshold is reached. This is an implementation description, not a guarantee of numerical stability for arbitrary parameters.
Reproduce bounded and deterministic controls
| Formula | Expected property |
|---|---|
=RANDBINOM(0.25;8) |
Integer from 0 through 8; no fixed next value |
=RANDBINOM(0;8) |
0 |
=RANDBINOM(0.25;0) |
0 |
=RANDBINOM(-0.1;8) |
#VALUE! |
For the sampled case, enter it once in A2. Inspect the resulting count rather than expecting 2. The model’s theoretical mean is 8×0.25 = 2, and its variance is 8×0.25×0.75 = 1.5; neither is a promised value of one draw or a tiny sample average.
Practical example: an eight-item batch
If eight independent items each have modeled event probability 0.25, the intended binomial quantity is the number with that event. Record the sampled count as one scenario and keep the assumptions beside it. Changing the probability or trial count changes the model, while reevaluating the same formula requests another scenario.
Use the deterministic p=0 control to check zero-event handling, and compute the theoretical mean separately for context. Do not label a small collection of plausible counts as a distribution validation. Any production simulation requires larger-scale numerical checks appropriate to its purpose.
Unsafe cases and compatibility
- Avoid p=1 with positive trials. The recurrence divides by
(1−p)and the wrapper does not handle that endpoint separately. - Large trial counts or extreme probabilities can underflow the initial mass and prevent the cumulative loop from progressing reliably. This guide does not recommend such stress inputs.
- Supply whole-number trial counts instead of depending on integer coercion of fractions.
- There is no seed parameter or fixed output sequence promised.
- The function returns a sampled count, not a binomial probability or cumulative probability.
- Evaluation-time sampling does not establish an automatic refresh timer.
Availability and verification
- Release checked: Calligra Sheets 26.08.2, using KDE’s release source package and release information, inspected on October 18, 2026. Relevant locations:
sheets/functions/math.cpplines 192–194 and 694–720. - Introduced: The original introduction version is not established by these sources. Current registration establishes presence in 26.08.2, not the first release.
- Lifecycle: Registered in the inspected release; no retirement or deprecation marker was found in this function’s registration. Retirement (removed support) and deprecation (discouraged but retained support) are different claims; neither is asserted here.
- Native testing: Selected cases were recalculated and saved in Calligra Sheets 25.04.2. The source discussion concerns 26.08.2. Unlisted examples and edge cases remain source-derived or independently calculated.
Related guides and sources
- AVERAGE
- VAR
- COUNT
- IF
- Calligra function guide index
- KDE formula entry instructions, checked October 18, 2026. Examples use leading
=and semicolons, with a period for decimal numbers. Confirm regional separators in your installation before pasting.
Selected native results and screenshot
These results were observed in Calligra Sheets 25.04.2, using an ODS input evaluated and saved by the native application. Formula references and results were read back from the saved workbook. These are samples from one captured calculation state, not fixed expected future draws or a statistical distribution validation. Reopening or recalculating may produce different samples. The source discussion remains scoped to 26.08.2; native observations are 25.04.2.
| Native formula | Observed display |
|---|---|
=RANDBINOM(0.25;8) |
1.0000000000 |
=RANDBINOM(0;8) |
0.0000000000 |
=RANDBINOM(0.25;0) |
0.0000000000 |
=RANDBINOM(-0.1;8) |
#VALUE! |
The sample count was 1, within 0 through 8. The safe p=0 and zero-trial cases returned 0, and the negative probability returned #VALUE!. The unsafe p=1 case and large-parameter cases were not run.

Screenshot: Genuine native 25.04.2 capture. Selected F2 contains =RANDBINOM(0.25;8) and displays 1.0000000000. Column F contains application results; column G contains descriptive formula labels. Column G identifies the full formula. The formula bar can be horizontally clipped on longer function names; the saved workbook independently confirms the expression.