MCPcopy
hub / github.com/react-grid-layout/react-grid-layout / generateMessyLayout

Function generateMessyLayout

test/spec/benchmark-test.js:45–57  ·  view source on GitHub ↗
(n, cols = 12)

Source from the content-addressed store, hash-verified

43
44// Generate a messy (uncompacted) layout
45function generateMessyLayout(n, cols = 12) {
46 const layout = [];
47 for (let i = 0; i < n; i++) {
48 layout.push({
49 i: String(i),
50 x: Math.floor(Math.random() * (cols - 2)),
51 y: Math.floor(Math.random() * (n / 2)),
52 w: 1 + Math.floor(Math.random() * 3),
53 h: 1 + Math.floor(Math.random() * 3)
54 });
55 }
56 return layout;
57}
58
59// Measure execution time of a function
60function measureTime(fn, iterations = 100) {

Callers 1

benchmark-test.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…