diff --git a/src/app/components/bingocontroller.tsx b/src/app/components/bingocontroller.tsx index 7f93cf5..cd8dc28 100644 --- a/src/app/components/bingocontroller.tsx +++ b/src/app/components/bingocontroller.tsx @@ -3,6 +3,16 @@ import React from 'react' import Bingo from './bingo.tsx' +function FisherYatesShuffle(array:string[]):string[]{ + for(let i = array.length - 1; i > 0; i--){ + const j = Math.floor(Math.random() * (i + 1)); + const temp = array[i]; + array[i] = array[j]; + array[j] = temp; + } + return array; +} + export default function BingoController(){ const [size, setSize] = React.useState(5); const buzzwords = ["Cloud", "Cyber", "Distruptive Technology", "AI", "Metaverse", "Gamification", "Web 2.0/3.0", "Industry 4.0", "Internet of Things", "Multiexperience", "Big Data", "Crypto", "[Insert bullshit here] as a service", "Emerging Market", "Streamline"]; @@ -19,7 +29,7 @@ export default function BingoController(){ 4x4 5x5 - Regenerate + setItems(FisherYatesShuffle(buzzwords))}>Regenerate {sizeError &&