UNPKG
@lucide/helpers
Version:
latest (1.0.0)
1.0.0
A internal used package with helpers.
@lucide/helpers
/
src
/
shuffleArray.mjs
13 lines
(12 loc)
•
300 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
/** *
@param
{array} array *
@returns
{array} */
export
const
shuffle
= (
array
) => {
// eslint-disable-next-line no-plusplus
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]]; }
return
array
; };