Skip to content

Commit 668f9a4

Browse files
committed
refactor: use const for shuffled in getRandomSubarray function
1 parent 2968484 commit 668f9a4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/views/DataThread.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ export const DataThread: FC<{}> = function ({ }) {
385385
return x - Math.floor(x);
386386
}
387387
const getRandomSubarray = (arr: any[], size: number) => {
388-
let shuffled = arr.slice(0), i = arr.length, temp, index;
388+
const shuffled = arr.slice(0);
389+
let i = arr.length, temp, index;
389390
while (i--) {
390391
index = Math.floor((i + 1) * getRandom(233 * i + 888));
391392
temp = shuffled[index];

src/views/EncodingShelfThread.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ export const ChartElementFC: FC<{chart: Chart, tableRows: any[], boxWidth?: numb
9494
return x - Math.floor(x);
9595
}
9696
const getRandomSubarray = (arr: any[], size: number) => {
97-
let shuffled = arr.slice(0), i = arr.length, temp, index;
97+
const shuffled = arr.slice(0);
98+
let i = arr.length, temp, index;
9899
while (i--) {
99100
index = Math.floor((i + 1) * getRandom(233 * i + 888));
100101
temp = shuffled[index];

0 commit comments

Comments
 (0)