RAND Function in ONLYOFFICE Spreadsheet Editor: Syntax and Examples
Generate a random decimal from zero inclusive to one exclusive, scale ranges, and audit recalculation limits.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in ONLYOFFICE Spreadsheet Editor. How formula examples are checked
Quick answer
=RAND() produces a random real number greater than or equal to 0 and strictly less than 1. It takes no arguments. =RAND()*6+2 has an expected mathematical range of [2, 8)—it is not guaranteed to produce an exact decimal that can be predicted before recalculation. The bounds and the scaled-interval technique are documented in the official RAND reference (accessed 2026-10-13).
Use RAND to create sample data, random practice problems, simulation inputs, or a temporary randomized sorting key. Do not use it for secure passwords, tokens, lotteries or other security-critical draws: the vendor article does not document cryptographic suitability or statistical quality.
Exact official syntax and arguments
=RAND()
- Required arguments: none; the parentheses remain part of the formula.
- Optional arguments/defaults: none; no seed, minimum or maximum argument is documented.
- Documented result: a numeric real value in the half-open interval 0 ≤ x < 1.
- Formula separator: none is needed for RAND alone; nested
IF,INTorANDexamples use commas in the English documented syntax. - No fixed result: examples can verify types, logical properties and range bounds, not an exact random decimal.
Official source: RAND syntax and example. The official INT reference documents the integer-part/floor behaviour needed for the dice example. Any particular decimal displayed by RAND is intentionally omitted.
Compatibility, locale and validation scope
The English ONLYOFFICE function catalogue and the official function article below were accessed on 2026-10-13. The catalogue covers the Spreadsheet Editor, while the Formula tab documentation explicitly illustrates both online and desktop interfaces. Neither article provides a minimum compatible Desktop Editors build or a release-by-release runtime matrix for this particular function.
- ONLYOFFICE Docs/web: included in the shared unversioned English Spreadsheet Editor help; behaviour described below is documentation-checked, not observed in a live web editor.
- ONLYOFFICE Desktop: the same function help is relevant to the desktop spreadsheet interface, but no installed version was executed; minimum supported build and edge-case parity remain unverified.
- Other editors: Excel compatibility is discussed only where official Microsoft documentation was checked; it is not a guarantee for LibreOffice, Google Sheets, imported workbooks, or all locales.
- Locale: all copy-ready examples use English names and commas, as illustrated in the English ONLYOFFICE documentation. Regional or localized installations may display other separators or translated function names. Inspect the function tooltip and regional settings in your own editor instead of blindly pasting examples (Advanced Settings).
- Validation performed: vendor documentation checking and independent mathematical calculations/range proofs for expected outputs. Native ONLYOFFICE Desktop execution: not run. Native ONLYOFFICE web execution: not run. No screenshots or observed formula outputs are claimed.
How to use and test in ONLYOFFICE
Open a blank worksheet, enter the provided inputs into the named cells, select an output cell, and type the formula with a leading =. Alternatively use Formula → Function, or the shortcut documented in the Insert Functions help. The Formula tab’s Calculation control can recalculate a sheet or workbook (Formula tab). If your installation rejects comma separators, use its actual localized formula syntax. Do not copy a column’s displayed sample results as though they were measured outputs.
Reproducible worksheet: controlled random values
Create an empty sheet with the following numeric constants. Set the cells to General/Number, not text:
| Cell | Type/value | Meaning |
|---|---|---|
| A1 | Minimum (text) |
Label |
| B1 | Maximum (text) |
Label |
| A2 | numeric 2 |
Lower endpoint |
| B2 | numeric 8 |
Upper endpoint (excluded by the scaled formula) |
| C1 | Sample (text) |
Label |
| C2 | formula =RAND() |
Random x with 0 ≤ x < 1 |
| D2 | formula =A2+C2*(B2-A2) |
Random number with 2 ≤ result < 8 |
| E2 | formula =AND(D2>=A2,D2<B2) |
Expected TRUE provided A2 < B2 |
The formulas in C2 and D2 should reference the same single RAND cell, so the E2 check verifies that sample. Using separate RAND calls in different parts of a formula can sample different values, and is not appropriate when you need one shared draw. This is a range proof, not a measurement from ONLYOFFICE.
Formula examples and expected results
| Formula | Expected result / invariant | Explanation |
|---|---|---|
=RAND() |
a real number in [0,1) | No fixed decimal; the endpoint 1 is excluded |
=RAND()*10 |
real number in [0,10) | Scaling by positive 10 |
=RAND()*6+2 |
real number in [2,8) | Shifting a six-unit interval |
=RAND()*100+100 |
real number in [100,200) | Positive scale and shift |
=INT(RAND()*6)+1 |
an integer from 1 to 6 inclusive | INT is floor on a nonnegative operand |
=INT(RAND()*10) |
an integer from 0 to 9 inclusive | Nonnegative floor of [0,10) |
=IF(RAND()<0.5,"A","B") |
text A or B | Branch result is variable |
=RAND()*0 |
number 0 | Zero multiplication gives an exact output |
=RAND()<0 |
FALSE | RAND never falls below zero |
=RAND()>=1 |
FALSE | RAND is always less than one |
=AND(RAND()>=0,RAND()<1) |
TRUE | Each call separately obeys its bounds |
=IF(RAND()>=0,1,0) |
number 1 | Always enters first branch |
All numeric outcomes that vary are shown as a mathematical range, not a fabricated sample value. The exact TRUE/FALSE/zero cases above follow directly from 0 ≤ RAND() < 1. The AND formula uses two separate calls, but each call satisfies the same documented bounds.
Advanced applications
Random six-sided die without decimal results
=INT(RAND()*6)+1 returns one of the integers 1 through 6. The derivation is 0 ≤ RAND()*6 < 6; applying INT makes an integer from 0 through 5; adding one gives 1 through 6. The INT rule is supported by ONLYOFFICE’s INT article. No particular face can be predicted in advance.
Random real number in a user-defined interval
With A2 = 2 and B2 = 8, use =A2+RAND()*(B2-A2) in an unused cell such as F2. The expected interval is [2,8) if A2 < B2. Changing B2 to a smaller value changes how the interval transforms, so do not reuse the label “lower” or the bound claim without testing input order. If you need a random integer including both endpoints, see the separately documented RANDBETWEEN function.
Sampling and preserving one value
For repeated calculations that must all refer to the same draw, put RAND in one helper cell and reference the helper; avoid calling RAND independently in every derived formula. To make a random value permanent, copy a result and use a paste-values workflow supported by your editor, then inspect that the cell no longer contains the original RAND formula. The vendor RAND article does not specify a cross-platform keyboard shortcut for freezing random results; do not apply an Excel-only shortcut without checking.
Recalculation and downstream effects
The ONLYOFFICE insertion guide says formula recalculation normally occurs when referenced inputs change, and the Formula tab provides manual recalculation. A RAND result may change after recalculation; a new draw can coincidentally equal an old value in a finite-precision implementation. Frequency, exact recalculation triggers, generation algorithm and reproducible seeding were not verified for a specific Desktop or web release.
Troubleshooting and limits
| Symptom | Likely explanation | Suggested check |
|---|---|---|
#NAME? or formula remains as text |
Function name not recognized, entry set to text, or formula missing = |
Confirm this release supports RAND and enter =RAND() in a General cell |
| A value differs from this guide | RAND is intentionally nondeterministic | Check the bound 0 ≤ result < 1 rather than a screenshot’s decimal |
| Value appears stale | Recalculation or caching may differ by editor/build | Use Formula → Calculation and observe it in your own build |
| Dice example yields decimals | Formula lacks the INT and +1 steps |
Use =INT(RAND()*6)+1 and inspect the cell format |
| A supposedly stable simulation changes | RAND is a calculated expression, not a permanent sampled constant | Copy/paste values after validation |
| Regional syntax fails | Comma/semicolon or translated function-name rules differ | Inspect the editor’s own function tooltip and settings |
Limits not established by this source: quality of pseudorandom distribution, independence, cryptographic security, precision, seeding options, and build-specific recalculation policy. These are not asserted. A mathematical range does not prove statistical uniformity in a particular implementation.
Compatibility notes
The Microsoft Excel RAND reference describes the same RAND() syntax and range, including Excel-specific recalculation behaviour. This establishes documented formula intent, not identical runtime behaviour on every ONLYOFFICE Desktop/web version. Google Sheets or LibreOffice support is not tested here. A workbook exported as XLSX should be opened and recalculated in the target product before relying on its output.
Official sources and research record
- ONLYOFFICE RAND function — exact syntax, no arguments, range, scaled interval. Accessed 2026-10-13; unversioned current English documentation.
- ONLYOFFICE Insert Functions — entry and recalculation basics, accessed 2026-10-13.
- ONLYOFFICE Formula tab — desktop/web UI and manual calculation, accessed 2026-10-13.
- ONLYOFFICE INT — integer operation used in examples, accessed 2026-10-13.
- ONLYOFFICE Advanced Settings — regional decimal/thousands formatting, accessed 2026-10-13.
- Microsoft Excel RAND — external compatibility cross-check only; accessed 2026-10-13.
Verification limits: Native Desktop/web execution, localized parsing, precise recalculation triggers and random-generator quality were not tested. Historical release support remains unestablished.