2D Integers Creator
Generate custom 2D integer arrays with multiple fill patterns. Export as CSV, JSON, or copy to clipboard. Visual heat map included.
About
Constructing a two-dimensional integer array by hand is tedious and error-prone. A misplaced value in row i, column j can cascade into incorrect matrix multiplications, broken image kernels, or flawed simulation grids. This tool generates arrays of size m × n (up to 50 × 50) using eight deterministic and stochastic fill strategies: uniform random within [min, max], sequential, diagonal, identity, symmetric, spiral, checkerboard, and Pascal row coefficients. Each cell value is a true 32-bit integer. The output is exportable as CSV, JSON array-of-arrays, or plain text. Note: the random generator relies on Math.random, which is a PRNG and not suitable for cryptographic applications.
Formulas
The random integer within a closed interval [a, b] is computed as:
For Pascal's triangle, each cell uses the binomial coefficient:
The identity matrix uses the Kronecker delta:
Where a = minimum value, b = maximum value, n = row index, k = column index, δij = Kronecker delta function.
Reference Data
| Fill Pattern | Algorithm | Typical Use Case | Symmetry | Value Range |
|---|---|---|---|---|
| Random | floor(random() × (max − min + 1)) + min | Test data, Monte Carlo input | None | [min, max] |
| Sequential | start + (i × cols + j) × step | Index mapping, lookup tables | None | [start, start + m×n×step] |
| Diagonal | i + j | Wave-front numbering, anti-diagonal indexing | Anti-diagonal | [0, m+n−2] |
| Identity | δ(i,j) × k | Linear algebra, basis matrices | Symmetric | {0, k} |
| Symmetric | A[i][j] = A[j][i] | Adjacency matrices, covariance stubs | Full symmetric | [min, max] |
| Spiral | Clockwise layer traversal | Matrix traversal problems, interview prep | None | [1, m×n] |
| Checkerboard | (i + j) mod 2 | Tiling, game boards, parity checks | Anti-diagonal | {val0, val1} |
| Pascal Row | C(i, j) for j ≤ i | Combinatorics, binomial coefficients | Left-triangular | [0, C(m−1, floor((m−1)/2))] |
| Random (Seeded) | Mulberry32 PRNG with user seed | Reproducible test data | None | [min, max] |
| Band Matrix | Non-zero only if |i−j| ≤ k | Tridiagonal systems, sparse storage | Optional | [min, max] |
| Toeplitz | A[i][j] = c[i−j] | Signal processing, convolution | Constant diagonals | [min, max] |
| Hadamard | Recursive ±1 matrix (power of 2) | Error correction, transforms | Symmetric, orthogonal | {−1, 1} |