Skip to content

Commit

Permalink
Update Utils.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
MastanSayyad committed Jul 26, 2024
1 parent 9b28856 commit c6b846a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Components/ChatBot/utils.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export const shuffleArray = (array) => {
let currentIndex = array.length, temporaryValue, randomIndex;

while (currentIndex !== 0) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex--;

temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}

return array;
};

0 comments on commit c6b846a

Please sign in to comment.