Last active
January 27, 2020 12:10
-
-
Save digitalbocca/f775ea56799f06786a043961a00f7d6a to your computer and use it in GitHub Desktop.
Modulo de teste deno.
This file contains 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
import sorteio from 'https://gist.githubusercontent.com/digitalbocca/f775ea56799f06786a043961a00f7d6a/raw/89ac726a0bf4d69224ab9972dcfd2aadc6d14e42/sorteio.deno.ts' | |
import { green } from 'https://deno.land/std/fmt/colors.ts' | |
console.clear() | |
console.log('SORTEANDO A LISTA A') | |
let listaA = [] | |
let premiados = 0 | |
let listaDePremios = [] | |
let premio = 592100 | |
for (let i = 0; i < 1000000; i++) { | |
let esteNumero = sorteio(1000000) | |
let bilhete = { | |
id: `${esteNumero}-${Date.now().toString()}`, | |
numero: esteNumero | |
} | |
listaA.push(bilhete) | |
} | |
listaA.forEach(item => { | |
console.log(`Sorteado: ${item.numero}`) | |
if (item.numero === premio) { | |
premiados++ | |
console.log('Temos um Acerto') | |
listaDePremios.push(item) | |
} | |
}) | |
console.log(`Total de Prêmios: ${premiados}`) | |
if (premiados > 0) { | |
listaDePremios.forEach(item => { | |
console.log(`Premiado o Bilhete ${item.id} com o número ${item.numero}`) | |
}) | |
} |
This file contains 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
export default val => Math.floor(Math.random() * val) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment