Browse Source

feat: add shuffle helper

pull/2558/head
Wing-Kam Wong 2 years ago
parent
commit
f4d90615bb
  1. 7
      packages/nocodb/src/lib/meta/helpers/shuffleHelper.ts

7
packages/nocodb/src/lib/meta/helpers/shuffleHelper.ts

@ -0,0 +1,7 @@
export function fisherYatesShuffle(arr: any[]): any[] {
for (let i = arr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[arr[i], arr[j]] = [arr[j], arr[i]];
}
return arr;
}
Loading…
Cancel
Save