diff options
| author | Adam Soltys <[email protected]> | 2023-11-20 09:26:06 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-11-20 09:26:06 -0800 |
| commit | 3a5d21db11a2f128e5f51df9c123b7abc367c778 (patch) | |
| tree | 52df486c0c06bc7e55773b49e18aad4c4e08d8ff /src/lib/utils.js | |
| parent | ee8d15697a3b758b8f26d7074edf017b3db6d480 (diff) | |
| download | coinos-ui-3a5d21db11a2f128e5f51df9c123b7abc367c778.tar.gz coinos-ui-3a5d21db11a2f128e5f51df9c123b7abc367c778.zip | |
randomize avatars
Diffstat (limited to 'src/lib/utils.js')
| -rw-r--r-- | src/lib/utils.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js index 9e1066e2..9b3e5592 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -256,3 +256,11 @@ export let types = { }; export let ease = (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t); + + export function shuffleArray(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [array[i], array[j]] = [array[j], array[i]]; + } + } + |
