Created
December 30, 2023 14:28
-
-
Save angelod1as/a6e1dac217c12f23cbcc8a66c7ebc38f to your computer and use it in GitHub Desktop.
Escolher os número pra jogar na Mega Sena
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const totalDeJogos = Array(10).fill() // Total de jogos: 10 | |
const numerosPorJogo = Array(6).fill() // Números por jogo: 6 | |
const numeroMaximo = 60 // Mínimo é 1, máximo é 60 | |
const gerarNumeroAleatorio = () => Math.floor(Math.random() * numeroMaximo) + 1 | |
// Pra cada jogo, gerar 10 números aleatórios e deixar legível para humanos | |
const jogos = totalDeJogos.map((_, index) => | |
`Jogo ${index + 1}: ${numerosPorJogo.map(() => | |
gerarNumeroAleatorio()).join(', ')}`).join('\n') | |
console.log(jogos) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment