0 purchases
dart collection sampler
dart_collection_sampler #
a small library implementing methods to sample items from collections
Usage #
A simple usage example:
void deal(int n, List<String> items, {required bool unique}) {
stdout.writeln("Picking $n from $items (unique: $unique)\n");
if (n == 1) {
stdout.writeln("Selected item: ${CollectionSampler().pick(items)}");
} else {
stdout.writeln(
"Selected items: ${CollectionSampler().pickN(items, n, unique: unique)}",
);
}
}
copied to clipboard
Features and bugs #
Please file feature requests and bugs at the issue tracker.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.