Skip to content

Instantly share code, notes, and snippets.

@ashishbeck
Last active November 2, 2022 12:46
Show Gist options
  • Save ashishbeck/e86222264f3b14523c0af6518b998f86 to your computer and use it in GitHub Desktop.
Save ashishbeck/e86222264f3b14523c0af6518b998f86 to your computer and use it in GitHub Desktop.
Get random numbers between range (for personal chores)
import 'dart:math';
void main() {
final total = 30;
final max = 100;
final from = 0;
List<int> items = [];
while (items.length < total) {
var rand = Random();
int item = rand.nextInt(max - from) + from;
if (items.contains(item)) {
continue;
}
items.add(item);
}
print(items);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment