Contact

RANDARRAY in ONLYOFFICE Spreadsheet Editor

Math and Trigonometry Intermediate ONLYOFFICE Spreadsheet Editor

Generate random arrays with explicit dimensions and bounds, distinguish integer and decimal modes, and verify properties without invented fixed random results.

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

Quick answer: =RANDARRAY(2,3,1,6,TRUE) describes a 2-by-3 array of integers from 1 through 6. Individual values are random; no fixed six-number result is expected.

Availability and evidence scope

  • Introduced: Original introduction release is not established by the checked sources.
  • Available: Listed in current unversioned ONLYOFFICE help, checked October 18, 2026.
  • Implementation inspected: Official SDKJS v10.0.0.169, commit 3679e0375a758d7dc59d31337a45461be3525ed8. The snapshot does not prove identical behavior in every installed editor.
  • Retired or deprecated: These sources do not establish retirement or formal deprecation.
  • Testing: Numerical examples are independent mathematical expectations, and implementation discrepancies are labeled source predictions. No ONLYOFFICE application or calculation-engine execution was performed.

The examples use English function names and commas. Use your locale’s argument separator if different. Retain full precision in formulas; round only the displayed result. Nested output grids describe source-derived array contents. Native spill placement, obstruction errors, array-entry shortcuts and recalculation behavior have not been tested in the application. Reserve a separate output area and follow the array-formula entry method supported by your installed editor; do not assume a particular keyboard shortcut or automatic spill behavior.

Syntax and scalar defaults

=RANDARRAY([rows], [columns], [min], [max], [whole_number])

Zero to five arguments are registered. For scalar arguments, rows and columns default to 1, min defaults to 0, max defaults to 1, and whole_number defaults to FALSE. Thus =RANDARRAY() describes a one-element array of decimal output.

Use TRUE for integer output and FALSE for decimal output. In the inspected scalar implementation, integer mode requires both bounds to be integers. It does not quietly round fractional bounds to a usable integer interval. Rows and columns, by contrast, are truncated toward zero before their validation.

The source marks the function for recalculation and calls JavaScript Math.random for each generated element. No seed argument is registered. The exact sequence, application recalculation timing and persistence across file reopen are not verified here. Treat the values as changeable rather than permanent identifiers or repeatable test inputs.

Step-by-step: a small integer grid

  1. Put rows 2 in A1, columns 3 in B1, minimum 1 in C1 and maximum 6 in D1.
  2. Keep a separate 2-by-3 result area available.
  3. Enter =RANDARRAY(A1,B1,C1,D1,TRUE) using your edition’s supported array-formula workflow.
  4. Check properties rather than comparing with a prewritten random grid: the shape should be 2 by 3, every element should be an integer, and each should lie from 1 through 6.

Duplicate values are allowed. Six draws do not imply that every integer 1–6 appears once. This formula is sampling with replacement, not a shuffle or a unique-ID generator. A short random grid may look uneven, and that alone does not establish a defect.

The inspected formula for integer mode is floor(U*(max-min+1))+min, where U comes from Math.random. With integer bounds 1 and 6, it maps the random interval into six possible integer outcomes. This source structure supports the intended bounded integer behavior; it is not a statistical quality test of a particular generator or runtime.

Deterministic checks using equal bounds

Equal bounds are permitted by the inspected validation because it rejects only min>max. =RANDARRAY(2,3,7,7,TRUE) is source-predicted to return:

Output row Column 1 Column 2 Column 3
1 7 7 7
2 7 7 7

The integer expression is floor(U)+7, which is 7 for the Math.random contract 0≤U<1. In decimal mode, =RANDARRAY(2,2,0.5,0.5,FALSE) predicts a 2-by-2 grid of 0.5 because the scale factor max−min is zero. These are deterministic source-derived checks, not captured application outputs.

Advanced example: bounded decimal scenarios

=RANDARRAY(3,2,10,20,FALSE) creates six decimal scenarios using U*(20-10)+10. In ideal arithmetic the interval is [10,20); ordinary floating-point rounding can affect representable endpoints. A decimal result should not be expected to be an integer, and formatting it with zero decimal places does not convert the stored value into an integer draw.

If you need repeatable analysis, retain the generated values as an approved static dataset using the editor’s appropriate values-only workflow, or use explicit fixed inputs. Re-evaluating the same formula is not a reproducibility mechanism. No seed, cryptographic security or guaranteed uniqueness is established by this implementation.

For a simple simulation, keep model inputs separate from the random grid and clearly label the distribution implied by the bounds. Uniform random draws between a minimum and maximum are not automatically a normal, empirical or weighted distribution. Transformations require a separately specified model.

Source-predicted errors and shape limits

  • min>max predicts internal wrong_value_type, conventionally #VALUE!.
  • Integer mode with either bound nonintegral also predicts #VALUE!; for example =RANDARRAY(2,2,0.5,6,TRUE).
  • Scalar dimensions are truncated with Math.trunc. A dimension truncating to zero returns the array_not_calc error category; a negative truncated dimension predicts #VALUE!. Exact native presentation of the former has not been verified here.
  • A scalar row-count times column-count product above 10,223,960 predicts #VALUE! in this source. This implementation ceiling is not a practical worksheet-placement recommendation.
  • The code has a separate range/array-argument mode whose output dimensions derive from argument arrays. The scalar examples do not establish that feeding a range as a dimension behaves like a scalar dimension, so use explicit scalar inputs unless that mode is separately checked.

No random samples were generated to stand in for application execution. Bounds, shape and deterministic equal-bound cases are the evidence appropriate to these examples.

Recalculate representative formulas when moving a workbook between editors. Matching names do not guarantee identical argument coercion, array behavior, numerical precision or error handling. These source-derived examples do not establish automatic spill behavior or a general import/export guarantee.

Official references