Last active
October 24, 2018 12:35
-
-
Save marcusedu/68d1aec23aa110218d476cc56aa7857c to your computer and use it in GitHub Desktop.
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 'dart:math'; | |
void main() { | |
sorteio(); | |
sorteio(); | |
sorteio(); | |
sorteio(); | |
sorteio(); | |
sorteio(); | |
} | |
List<int> sorteio(){ | |
List<int> lista = []; | |
for(var i=0;i<101;i++)lista.add(i); | |
List<int> sorteados = []; | |
var mRandom = Random(); | |
for(var i=0;i<20;i++) { | |
var index = mRandom.nextInt(lista.length); | |
sorteados.add(lista[index]); | |
lista.removeAt(index); | |
} | |
print("São ${sorteados.length} numeros sorteados: $sorteados\n"); | |
return sorteados; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment