diff --git a/src/Components/ChatBot/utils.jsx b/src/Components/ChatBot/utils.jsx index e69de29..49124ba 100644 --- a/src/Components/ChatBot/utils.jsx +++ b/src/Components/ChatBot/utils.jsx @@ -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; + }; + \ No newline at end of file