MenEnger / dart_multiple_random_choice

A multiple randomly choicing function library
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

A multiple randomly choosing function library

Features

Usage / Example

import 'package:multiple_random_choice/multiple_random_choice.dart';

// weighted multiple random choice
final m = {
  'A': 1.0,
  'B': 2.0,
  'C': 10.0,
  'D': 20,
  'E': 1,
};
final s = randomMultipleWeightedChoice<String>(m, 3, null);
print(s);
// {C,D,B}

// equally weight random multiple choice
final ss = randomMultipleChoice<String>(['A', 'B', 'C', 'D', 'E'], 2, null);
print(ss);
//ex. {C, D}

You can see more examples in example folder.