MCPcopy Create free account
hub / github.com/bvaughn/react-virtualized / generateRandomList

Function generateRandomList

src/utils/data.ts:13–35  ·  view source on GitHub ↗
(count = 1000)

Source from the content-addressed store, hash-verified

11 * Generate random data for use in examples.
12 */
13export function generateRandomList(count = 1000): ListItem[] {
14 const list: ListItem[] = [];
15
16 for (let i = 0; i < count; i++) {
17 const random = LOREM_IPSUM[i % LOREM_IPSUM.length];
18 const randoms = [random];
19
20 for (let j = Math.round(Math.random() * 10); j--; ) {
21 randoms.push(LOREM_IPSUM[(i * j) % LOREM_IPSUM.length]);
22 }
23
24 list.push({
25 color: BADGE_COLORS[i % BADGE_COLORS.length],
26 index: i,
27 name: NAMES[i % NAMES.length],
28 random,
29 randomLong: randoms.join(" "),
30 size: ROW_HEIGHTS[Math.floor(Math.random() * ROW_HEIGHTS.length)]
31 });
32 }
33
34 return list;
35}
36
37const BADGE_COLORS = [
38 "#f44336",

Callers 1

data.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected