← All procedures

generators.coveringArray

This function gives a covering array of strength `t` over dimensions with `levels[i]` levels each. Each row has the index of one level of each dimension. With fewer dimensions than `t`, the array covers each combination of all the dimensions. Thus no dimensions give one empty row, as the product of no sets has one item.

CLI
Package
@procedures/generators · README
Path
["generators","coveringArray"]
CLI
mark generators coveringArray --levels <number[]> --r <object>
As data
{"$proc":["generators","coveringArray"],"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","coveringArray"], { levels: [], r: {} });
console.log(JSON.stringify(result));

From the command line

$ mark generators coveringArray --levels <number[]> --r <object>

As data, in a program

{
  "$proc": ["generators", "coveringArray"],
  "input": { "levels": [], "r": {} }
}

Input

FieldTypeRequiredDefaultDescription
levelsnumber[]yes
robjectyesThe input of random: the procedure makes the Random with random(seed) before the call.
optionsobjectno

Output

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

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "levels": {
        "type": "array",
        "items": {
          "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."
      },
      "options": {
        "type": "object",
        "properties": {
          "strength": {
            "type": "number",
            "description": "The strength `t`: each `t` values of `t` different dimensions are in one row or more. The default is 2."
          },
          "candidates": {
            "type": "number",
            "description": "The count of candidate rows for each row that the array keeps. The default is `COVERING_CANDIDATES`."
          }
        },
        "additionalProperties": {}
      }
    },
    "required": [
      "levels",
      "r"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "array",
    "items": {
      "type": "array",
      "items": {
        "type": "number"
      }
    }
  }
}