Skip to content

a small library implementing methods to sample items from collections

License

Notifications You must be signed in to change notification settings

Adventuresmith/dart_collection_sampler

Repository files navigation

dart_collection_sampler

Pub Package Dart codecov Contributor Covenant

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)}",
    );
  }
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

About

a small library implementing methods to sample items from collections

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages