Add utility to generate a random game code.

This commit is contained in:
Oliver-Akins 2020-09-28 23:07:19 -06:00
parent de8b4a1b62
commit 44782f3e85

10
src/utils/gamecode.ts Normal file
View file

@ -0,0 +1,10 @@
export const generate_game_code = (): string => {
let game_code = ``;
// Generate the game code using the length given
do {
game_code += Math.floor(Math.random() * 9);
} while (game_code.length < 6);
return game_code
}