MCPcopy Create free account
hub / github.com/CodeGoat24/UniGenBench / getRandomSubarray

Function getRandomSubarray

docs/static/explorer-index.js:115–130  ·  view source on GitHub ↗
(size, arr=null)

Source from the content-addressed store, hash-verified

113}
114
115function getRandomSubarray(size, arr=null) {
116 if (arr == null) {
117 arr = [];
118 for (let i = 1; i < 1001; i++) {
119 arr.push(i);
120 }
121 }
122 var shuffled = arr.slice(0), i = arr.length, temp, index;
123 while (i--) {
124 index = Math.floor((i + 1) * Math.random());
125 temp = shuffled[index];
126 shuffled[index] = shuffled[i];
127 shuffled[i] = temp;
128 }
129 return shuffled.slice(0, size);
130}
131
132function refresh_table(qids) {
133 let table = document.getElementById('result-table');

Callers 1

explorer-index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected