RAND Function (OpenOffice Calc)
The RAND function in OpenOffice Calc returns a random decimal number between 0 and 1. Learn syntax, recalculation behavior, examples, and best practices.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✔ |
| Onlyoffice | ✔ |
| Openoffice | ✔ |
| Wps | ✔ |
| Zoho | ✔ |
What the RAND Function Does â–¾
- Returns a random decimal number in the range 0 ≤ x < 1
- Recalculates on every sheet update
- Useful for simulations, sampling, shuffling, and procedural logic
- Works across sheets
- Pairs naturally with INT, ROUND, and RAND BETWEEN
RAND is ideal when you need uniform random values.
Syntax â–¾
RAND()
Arguments:
- None — RAND takes no parameters.
RAND recalculates whenever the sheet recalculates.
To freeze a value, copy → Paste Special → Values Only.
To freeze a value, copy → Paste Special → Values Only.
Basic Examples â–¾
Generate a random decimal between 0 and 1
=RAND()
Generate a random decimal between 0 and N
=RAND() * N
Generate a random decimal between A and B
=A + RAND() * (B - A)
Integer Randomization (Manual RAND.BETWEEN) â–¾
Random integer between 1 and 10
=INT(RAND() * 10) + 1
Random integer between A and B
=INT(RAND() * (B - A + 1)) + A
Random even number between 0 and 20
=INT(RAND() * 11) * 2
Random multiple of 5 between 0 and 100
=INT(RAND() * 21) * 5
Advanced Examples â–¾
Random boolean (TRUE/FALSE)
=RAND() < 0.5
Random sign (−1 or +1)
=IF(RAND() < 0.5; -1; 1)
Random selection from a list
=INDEX(List; INT(RAND() * ROWS(List)) + 1)
Shuffle rows (sort by RAND)
Add a helper column:
=RAND()
Then sort by that column.
Random date between two dates
=StartDate + INT(RAND() * (EndDate - StartDate + 1))
Random time of day
=RAND()
(Time is stored as a fraction of a day.)
Random normal distribution (Box–Muller)
=SQRT(-2 * LN(RAND())) * COS(2 * PI() * RAND())
Random yes/no with weighted probability
70% yes, 30% no:
=IF(RAND() < 0.7; "Yes"; "No")
RAND across sheets
=RAND()
(Each call is independent.)
Recalculation Behavior â–¾
RAND updates when:
- You edit any cell
- You press F9
- You open the file
- Dependent formulas recalc
To freeze values:
- Select the RAND cells
- Copy
- Paste Special → Values Only
Common Errors and Fixes â–¾
RAND returns Err:508 (Missing parenthesis)
Occurs when:
- You forget the parentheses:
=RANDinstead of=RAND() - You mix commas and semicolons
RAND returns unexpected results
Possible causes:
- Forgetting that RAND recalculates
- Using RAND inside volatile formulas
- Using RAND for integer ranges without INT
RAND ignores values you expected it to include
RAND ignores:
- All arguments (it takes none)
- Text
- Logical values
RAND includes values you expected it to ignore
RAND includes:
- Nothing — it generates its own value
Best Practices â–¾
- Use RAND for simulations and sampling
- Use INT(RAND()*N)+1 for integer ranges
- Freeze values when you need reproducibility
- Use RAND with INDEX for random selection
- Use RAND with SORT for shuffling
- Use RAND with LN and PI for random distributions
RAND is the foundation of procedural generation — pair it with INT, INDEX, and MOD to build powerful random systems.