chore: randomize featured posts on build
This commit is contained in:
parent
6f30c62761
commit
4b0ff04023
2 changed files with 11 additions and 1 deletions
9
config/utilities/index.js
Normal file
9
config/utilities/index.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
export const shuffleArray = array => {
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
let j = Math.floor(Math.random() * (i + 1));
|
||||
let temp = array[i];
|
||||
array[i] = array[j];
|
||||
array[j] = temp;
|
||||
}
|
||||
return array
|
||||
}
|
Reference in a new issue