Skip to content

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

Code of conduct

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages