MCPcopy Create free account
hub / github.com/avoidwork/filesize.js / generateRandomValues

Function generateRandomValues

benchmarks/stress-test.js:69–96  ·  view source on GitHub ↗

* Generates random test values * @param {number} count - Number of values to generate * @returns {Array} Array of random values

(count)

Source from the content-addressed store, hash-verified

67 * @returns {Array} Array of random values
68 */
69function generateRandomValues(count) {
70 const values = [];
71 for (let i = 0; i < count; i++) {
72 // Generate various types of values
73 const type = Math.floor(Math.random() * 6);
74 switch (type) {
75 case 0:
76 values.push(0);
77 break;
78 case 1:
79 values.push(Math.random() * 1024);
80 break;
81 case 2:
82 values.push(Math.random() * 1048576);
83 break;
84 case 3:
85 values.push(Math.random() * 1073741824);
86 break;
87 case 4:
88 values.push(Math.random() * Number.MAX_SAFE_INTEGER);
89 break;
90 case 5:
91 values.push(-Math.random() * 1048576);
92 break; // Negative values
93 }
94 }
95 return values;
96}
97
98/**
99 * Prints stress test results

Callers 1

stress-test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected