Skip to content

Main content

Random Dashboard Widget Layout Generator

Pack supplied rectangular widgets into a cell grid with randomized bounded backtracking and validated nonoverlap placements.

Loading tool…

Description

Pack supplied rectangular widgets into a cell grid with randomized bounded backtracking and validated nonoverlap placements.

An interface fixture makes content and state explicit so a consumer can test a rendering or interaction. Literal labels, modeled states, and calculated geometry remain separate from what a browser or assistive technology actually displays or announces.

Pack supplied rectangular widgets into a cell grid with randomized bounded backtracking and validated nonoverlap placements.

When to use this tool

Use this generator to create reproducible dashboard widget layout cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply rows, columns, widgets, allowRotation, maximumSearchNodes in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read placements, occupancy, occupancyJson, exploredPlacements. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.

Shuffle widget processing order and search delegated empty-rectangle placements on a cell board, optionally allowing quarter turns. Mark occupied cells with original widget index plus one and return the first complete placement, occupancy matrix, and explored-placement count.1

Delegated operations used for this result: grid inventory rectangle fit checker; as json. Their calculation or parsing conventions apply to the corresponding result fields.2, 3

Input fieldMeaning and unitsAccepted input
rowsRowsRequired. Safe integer; minimum 1; maximum 16.
columnsColumnsRequired. Safe integer; minimum 1; maximum 16.
widgetsWidgetsRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 12.
widgets[].idLiteral identifier used independently of display labels.Required. Text; minimum UTF-16 length 1; maximum UTF-16 length 64.
widgets[].widthCellsWidth CellsRequired. Safe integer; minimum 1; maximum 16.
widgets[].heightCellsHeight CellsRequired. Safe integer; minimum 1; maximum 16.
allowRotationAllow RotationRequired. Boolean.
maximumSearchNodesMaximum Search NodesRequired. Safe integer; minimum 1; maximum 20000.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
placementsPlacementsRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 12.
placements[].idLiteral identifier used independently of display labels.Required. Text.
placements[].rowRowRequired. Safe integer; minimum 0; maximum 15.
placements[].columnColumnRequired. Safe integer; minimum 0; maximum 15.
placements[].heightCellsHeight CellsRequired. Safe integer; minimum 1; maximum 16.
placements[].widthCellsWidth CellsRequired. Safe integer; minimum 1; maximum 16.
occupancyOccupancyRequired. Array of Array of Safe integer; minimum 0; maximum 12.; minimum items 1; maximum items 16.; minimum items 1; maximum items 16.
occupancyJsonOccupancy JsonRequired. Text; maximum UTF-16 length 4096.
exploredPlacementsExplored PlacementsRequired. Safe integer; minimum 1; maximum 20000.
randomnessReplay source and normalized 32-bit seed, or null seed for an advancing context source.Required. Object; no unknown keys.
randomness.seedOptional safe-integer replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "rows": 2,
    "columns": 2,
    "widgets": [
      {
        "id": "a",
        "widthCells": 2,
        "heightCells": 1
      },
      {
        "id": "b",
        "widthCells": 2,
        "heightCells": 1
      }
    ],
    "allowRotation": false,
    "maximumSearchNodes": 100,
    "seed": 42
  },
  "output": {
    "placements": [
      {
        "id": "a",
        "row": 1,
        "column": 0,
        "heightCells": 1,
        "widthCells": 2
      },
      {
        "id": "b",
        "row": 0,
        "column": 0,
        "heightCells": 1,
        "widthCells": 2
      }
    ],
    "occupancy": [
      [
        2,
        2
      ],
      [
        1,
        1
      ]
    ],
    "occupancyJson": "[[2,2],[1,1]]",
    "exploredPlacements": 2,
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • Zero cells are empty. Total area fitting does not prove the shapes fit, and maximumSearchNodes can terminate search. This is discrete nonoverlapping layout rather than CSS rendering or an optimal arrangement.
  • A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random Dashboard Widget Layout Generator — tool.io

  2. Calculation or validation: game/grid-inventory-rectangle-fit-checker — tool.io

  3. Calculation or validation: matrix/as-json — tool.io

Similar or alternative tools