{
  "category": "Math and trigonometry functions",
  "display_name": "RANDARRAY",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.RANDARRAY",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 2 workbook cells. A volatile function: the recorded formulas hold it fixed, for example RAND()*0, so these cells show that the call works and not a clock or random value.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 2 recorded answers",
    "workbook_corpus": {
      "cells": 2,
      "matched": 2
    }
  },
  "implementations": [
    {
      "commit": "9e1884369a678158dd82d3d74188daf986995e87",
      "flavour": "excel-compatibility-candidate",
      "language": "Rust",
      "name": "CalcFunc",
      "own_code": [
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/random.rs#L47-L80"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/random::draw"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/random.rs#L47-L80",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 2 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.RANDARRAY.json",
  "name": "RANDARRAY",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[RAND](FUNC.RAND.md) returns one unit-interval value. [RANDBETWEEN](FUNC.RANDBETWEEN.md) requests\none bounded integer. [SEQUENCE](FUNC.SEQUENCE.md) creates a deterministic grid. A sampler with an\nexplicit seed is more suitable for reproducible experiments, but its stream need not be Excel's.\n\n\n",
    "how-to-implement": "\nValidate dimensions before allocation and check their product for overflow. Make the source of\nrandomness an explicit service so that recalculation, stream ownership and replay are under the\ncaller's control. Fill one two-dimensional result using a declared traversal order.\n\nFor a chosen continuous sampler, transforming a unit draw with `min + u*(max-min)` is a common\nstarting point, but the arithmetic can overflow or round to an endpoint. For uniform bounded\nintegers, rejection sampling avoids the bias that a naive modulo or floor construction can\nintroduce when the source range is not a multiple of the target range.\n\nThose are choices for a new sampler. Reproducing Excel additionally requires observations of\nits generator, seed or stream state, integer mapping and draw order. Matching the requested\nrange and array shape does not reproduce Excel's random sequence. Keep missing randomness a\nrefusal rather than silently returning cached or deterministic values.\n\n\n",
    "quirks": "\nAn array needs enough empty worksheet cells to spill. A blocked spill and invalid function\narguments are separate problems. A formula used as a random sort key can change on recalculation,\nso do not treat a recalculated random array as a persistent identifier.\n\nMicrosoft says the minimum must be less than the maximum and documents `#VALUE!` otherwise.\nThe OneCalc kernel accepts equal endpoints and returns that value. There is no measured Excel\ncomparison here resolving the equal-endpoint case; the two accounts must remain distinct.\n\nThe continuous distribution, integer endpoint handling and treatment of non-integral dimensions\nneed separate checks. A real-number interval formula does not by itself prove which binary64\nendpoints are attainable. Drawing successive values from a pseudorandom stream also does not\nprove statistical independence.\n\n\n",
    "sources": "\n- [Microsoft: RANDARRAY function](https://support.microsoft.com/en-us/excel/functions/randarray-function).\n- Lemire, *Fast random integer generation in an interval* (2019), for bounded-integer bias.\n- L'Ecuyer and Simard, *TestU01* (2007), for testing random streams.\n\n",
    "try-it": "\nThe example is editable, but OneCalc does not supply a random stream in this preview. Calculate\nreports that limit explicitly. It does not substitute a fixed sample or a different generator.\n\n\n",
    "version-differences": "\nMicrosoft lists RANDARRAY for Microsoft 365 and Excel 2021/2024, including the listed mobile\neditions. No comparison of generated streams or endpoint rules between named builds is\nrecorded here. Product availability is separate from the random algorithm used by a build.\n\n\n",
    "what-it-does": "\n`RANDARRAY([rows], [columns], [min], [max], [whole_number])` returns an array of random values.\nThe defaults are one row, one column, minimum 0, maximum 1 and decimal results. Set\n`whole_number` to TRUE to request integers.\n\n`=RANDARRAY(2,3)` requests two rows and three columns. `=RANDARRAY(2,3,1,6,TRUE)` requests a grid\nof whole numbers in the stated range. The array changes when Excel recalculates it; copy and\npaste values if a particular sample must be retained.\n\n\n"
  },
  "signature": {
    "display": "RANDARRAY([rows], [columns], [min], [max], [whole_number])",
    "parameters": [
      {
        "description": null,
        "name": "rows",
        "optional": true,
        "repeats": false
      },
      {
        "description": null,
        "name": "columns",
        "optional": true,
        "repeats": false
      },
      {
        "description": null,
        "name": "min",
        "optional": true,
        "repeats": false
      },
      {
        "description": null,
        "name": "max",
        "optional": true,
        "repeats": false
      },
      {
        "description": null,
        "name": "whole_number",
        "optional": true,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 5,
        "min": 0
      },
      "category": "Math and trigonometry functions",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "PseudoRandom",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "RandomProvider",
        "host_interaction_class": "ApplicationState",
        "kernel_signature_class": "Custom",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RandomProvider",
        "thread_safety_class": "HostSerialized",
        "volatility_class": "VolatileFull"
      },
      "descriptions": {
        "long": null,
        "short": "An array of random numbers of a given size, within limits, whole or decimal",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns an array of random numbers between 0 and 1. However, you can specify the number of rows and columns to fill, minimum and maximum values, and whether to return whole numbers or decimal values.",
        "microsoft_url": "https://support.microsoft.com/en-us/office/randarray-function-21261e55-3bec-4885-86a6-8b0a47fd4d33"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "RANDARRAY"
        },
        {
          "locale": "bg-BG",
          "name": "RANDARRAY"
        },
        {
          "locale": "cs-CZ",
          "name": "RANDARRAY"
        },
        {
          "locale": "da-DK",
          "name": "SLUMPMATRIX"
        },
        {
          "locale": "de-DE",
          "name": "RANDARRAY"
        },
        {
          "locale": "el-GR",
          "name": "RANDARRAY"
        },
        {
          "locale": "en-AU",
          "name": "RANDARRAY"
        },
        {
          "locale": "en-GB",
          "name": "RANDARRAY"
        },
        {
          "locale": "en-US",
          "name": "RANDARRAY"
        },
        {
          "locale": "es-ES",
          "name": "MATRIZALEAT"
        },
        {
          "locale": "et-EE",
          "name": "RANDARRAY"
        },
        {
          "locale": "fi-FI",
          "name": "SATUNN.MATRIISI"
        },
        {
          "locale": "fr-FR",
          "name": "TABLEAU.ALEA*"
        },
        {
          "locale": "he-IL",
          "name": "RANDARRAY"
        },
        {
          "locale": "hr-HR",
          "name": "RANDARRAY"
        },
        {
          "locale": "hu-HU",
          "name": "VÉLETLENTÖMB"
        },
        {
          "locale": "id-ID",
          "name": "RANDARRAY"
        },
        {
          "locale": "it-IT",
          "name": "RANDARRAY"
        },
        {
          "locale": "ja-JP",
          "name": "RANDARRAY"
        },
        {
          "locale": "ko-KR",
          "name": "RANDARRAY"
        },
        {
          "locale": "lt-LT",
          "name": "RANDARRAY"
        },
        {
          "locale": "lv-LV",
          "name": "RANDARRAY"
        },
        {
          "locale": "nb-NO",
          "name": "RANDARRAY"
        },
        {
          "locale": "nl-NL",
          "name": "ASELECT.MATRIX"
        },
        {
          "locale": "pl-PL",
          "name": "LOSOWA.TABLICA"
        },
        {
          "locale": "pt-BR",
          "name": "RANDARRAY"
        },
        {
          "locale": "pt-PT",
          "name": "MATRIZALEATÓRIA"
        },
        {
          "locale": "ro-RO",
          "name": "RANDARRAY"
        },
        {
          "locale": "ru-RU",
          "name": "СЛМАССИВ"
        },
        {
          "locale": "sk-SK",
          "name": "RANDARRAY"
        },
        {
          "locale": "sl-SI",
          "name": "RANDARRAY"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "RANDARRAY"
        },
        {
          "locale": "sv-SE",
          "name": "SLUMPMATRIS"
        },
        {
          "locale": "th-TH",
          "name": "RANDARRAY"
        },
        {
          "locale": "tr-TR",
          "name": "RASGDİZİ"
        },
        {
          "locale": "uk-UA",
          "name": "RANDARRAY"
        },
        {
          "locale": "vi-VN",
          "name": "RANDARRAY"
        },
        {
          "locale": "zh-CN",
          "name": "RANDARRAY"
        },
        {
          "locale": "zh-HK",
          "name": "RANDARRAY"
        },
        {
          "locale": "zh-TW",
          "name": "RANDARRAY"
        }
      ],
      "signature": {
        "display": "RANDARRAY([rows], [columns], [min], [max], [whole_number])",
        "parameters": [
          {
            "description": null,
            "name": "rows",
            "optional": true,
            "repeats": false
          },
          {
            "description": null,
            "name": "columns",
            "optional": true,
            "repeats": false
          },
          {
            "description": null,
            "name": "min",
            "optional": true,
            "repeats": false
          },
          {
            "description": null,
            "name": "max",
            "optional": true,
            "repeats": false
          },
          {
            "description": null,
            "name": "whole_number",
            "optional": true,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "RANDARRAY",
      "version_marker": null,
      "xlcall": null
    },
    "microsoft": "https://support.microsoft.com/en-us/office/randarray-function-21261e55-3bec-4885-86a6-8b0a47fd4d33"
  },
  "try_it": {
    "formula": "=RANDARRAY(2,3)",
    "note": "OneCalc does not supply a random-number source in this preview.",
    "preview_status": "refused"
  },
  "url": "https://handbook.dnacalc.com/functions/RANDARRAY.html",
  "variants": [],
  "versions": []
}