Skip to content

Instantly share code, notes, and snippets.

@angelod1as
Created December 30, 2023 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelod1as/a6e1dac217c12f23cbcc8a66c7ebc38f to your computer and use it in GitHub Desktop.
Save angelod1as/a6e1dac217c12f23cbcc8a66c7ebc38f to your computer and use it in GitHub Desktop.
Escolher os número pra jogar na Mega Sena
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