← All procedures

generators.stratifiedDesign

This function gives a stratified grid: `strata` strata on each axis, so `strata^d` cells, and one uniform point in each cell. The cells go in the order of their index in base `strata`, with the first dimension as the last digit.

CLI
Package
@procedures/generators · README
Path
["generators","stratifiedDesign"]
CLI
mark generators stratifiedDesign --strata <number> --d <number> --r <object>
As data
{"$proc":["generators","stratifiedDesign"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/generators/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["generators","stratifiedDesign"], { strata: 1, d: 1, r: {} });
console.log(JSON.stringify(result));

From the command line

$ mark generators stratifiedDesign --strata <number> --d <number> --r <object>

As data, in a program

{
  "$proc": ["generators", "stratifiedDesign"],
  "input": { "strata": 1, "d": 1, "r": {} }
}

Input

FieldTypeRequiredDefaultDescription
stratanumberyes
dnumberyes
robjectyesThe input of random: the procedure makes the Random with random(seed) before the call.
limitnumberno

Output

The schema does not list fields (number[][]).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "strata": {
        "type": "number"
      },
      "d": {
        "type": "number"
      },
      "r": {
        "type": "object",
        "properties": {
          "seed": {
            "type": [
              "string",
              "number"
            ]
          }
        },
        "required": [
          "seed"
        ],
        "additionalProperties": false,
        "x-procedures-construct": {
          "function": "random",
          "params": [
            "seed"
          ]
        },
        "description": "The input of random: the procedure makes the Random with random(seed) before the call."
      },
      "limit": {
        "type": "number"
      }
    },
    "required": [
      "strata",
      "d",
      "r"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "array",
    "items": {
      "type": "array",
      "items": {
        "type": "number"
      }
    }
  }
}