RANDLOG Function (Gnumeric)
RANDLOG(p) generates a positive integer from the logarithmic-series distribution. It is not a logarithm function, and the helper requires the strict probability range 0<p<1.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: RANDLOG(p) generates a positive integer from the logarithmic-series distribution. It is not a logarithm function, and the helper requires the strict probability range 0<p<1.
Syntax
=RANDLOG(p)
Availability and evidence
- Introduction: Gnumeric 1.1.6 NEWS explicitly lists this new function. This release-history evidence is separate from a native test of that old version.
- Source support: Registered in the Gnumeric 1.12.62 random plugin. No retirement is established; the last functioning native application version is unverified.
- Evidence dates: Official Gnumeric source retained October 13–14, 2026 was reviewed October 15. Mathematical controls were independently recalculated October 15. No native application, compiled Gnumeric helper or random generator was executed.
Parameter and source contract
The single p argument is required. The worksheet callback rejects values below 0 or above 1; the helper additionally rejects both endpoints 0 and 1. Therefore the implemented range is strictly 0<p<1, and invalid endpoints produce #NUM!.
For a valid p, the ideal output support is 1,2,3,…, with probability -(p^k)/(k*LN(1-p)) at integer k≥1. To express this unambiguously as a Gnumeric worksheet formula, negate the complete power: -(p^k)/(k*LN(1-p)).
This function generates a variate. It neither computes LN(p) nor returns the probability of a specified k. Its name refers to the series normalization, -LN(1-p), in the distribution.
Complete worksheet setup
Create LogSeriesControls. Put parameter 0.5 in B2 and enter =RANDLOG($B$2) in D2. D2 is a changing positive integer; no fixed expected draw is supplied.
The ideal mean is =-B2/((1-B2)*LN(1-B2)), approximately 1.44269504089. The ideal variance is =-B2*(B2+LN(1-B2))/((1-B2)^2*LN(1-B2)^2), approximately 0.804021100772. The parameter 0.5 is not the mean or the probability of output 0, which is outside the ideal support.
Reproducible probability table
Put integers 1 through 6 in A7:A12. In B7 enter =-($B$2^A7)/(A7*LN(1-$B$2)) and fill down. The parentheses explicitly negate the complete power, avoiding Gnumeric’s unary-negation precedence trap.
| Supplied input or fixed count | Independent reference result |
|---|---|
| k=1, p=0.5 | 0.7213475204445 |
| k=2, p=0.5 | 0.1803368801111 |
| k=3, p=0.5 | 0.06011229337037 |
| k=4, p=0.5 | 0.02254211001389 |
| k=5, p=0.5 | 0.009016844005556 |
| k=6, p=0.5 | 0.003757018335648 |
These are ideal probabilities for fixed k values, not random samples. The six rows do not cover all positive integers; their sum is below 1. The largest probability occurs at 1 for the chosen parameter, but D2 is not required to return 1.
Advanced: distinguish the source algorithm from inverse-CDF teaching
The helper sets c=LOG1P(-p), obtains a nonzero driver V, and returns 1 immediately if V≥p. Otherwise it obtains another nonzero U and forms q=-EXPM1(c*U).
It returns a floored logarithmic expression when V≤q², returns 2 when q²<V≤q, and otherwise returns 1. The algorithm does not simply evaluate the PMF formula from the probability table, nor does it expose V and U as worksheet arguments.
For p 0.5, supplied V0.75 takes the first return 1 branch. With V0.25 and U0.5, q=1-SQRT(0.5), approximately 0.292893218813; q²<V≤q gives 2. These are deterministic source-branch controls, not observed random draws.
Advanced: check the normalization
The power series sum of p^k/k over positive integers is -LN(1-p). Dividing its terms by this normalizer makes the total ideal probability 1. For p 0.5, the probability of 1 is approximately 0.721347520444, much larger than p itself.
The probability of at least 2 is approximately 0.278652479556. Therefore treating p as a success probability for a one-trial Bernoulli event would give a different model. RANDLOG and RANDGEOM both produce integer counts, but their supports and probability laws differ.
Advanced: shifting the support
If a worksheet needs a zero-based count based on this model, =D2-1 shifts the same variate. Its ideal mean becomes approximately 0.442695040889, while variance remains approximately 0.804021100772.
That shift does not turn the distribution into a geometric one. A shared starting point of zero is insufficient to establish the same probability mass function. Keep the chosen distribution and any shift explicit in labels and formulas.
Endpoint and interpretation controls
=RANDLOG(0), =RANDLOG(1), =RANDLOG(-0.1) and =RANDLOG(1.1) give #NUM!. Values strictly between 0 and 1 are accepted, including non-simple decimals; they are not rounded to a binary category.
The source uses LOG1P and EXPM1 for numerical stability, whereas the simple LN-based worksheet probabilities are ordinary-domain teaching formulas. Near the endpoints, cancellation and extreme tails require separate numerical analysis; these examples do not certify a native endpoint approximation.
Recalculation and verification limits
The plugin marks this function volatile. Recalculation can replace a result, and the worksheet signature has no seed argument. Exact GUI triggers and saved-file replay were not tested. Separate calls do not promise matched internal drivers, while repeated references to one random cell do not constitute independent observations.
The controls here are independent mathematical or source-branch expectations, not generated samples. Ideal probability distributions are distinct from the finite-resolution implementation. Rounding, underflow, overflow and non-finite intermediates can affect extreme inputs; non-finite numeric results become #NUM!. No native application, compiled Gnumeric helper, random generator, empirical distribution-quality test or file-transfer test was executed. Use explicit finite numeric inputs; text and blank coercion are not certified by these controls.