weighted_random 0.1.0 copy "weighted_random: ^0.1.0" to clipboard
weighted_random: ^0.1.0 copied to clipboard

outdated

Weighted Random Algorithm for Dart libraries or applications.

Weighted Random for Dart #

Getting started #

In your flutter project add the dependency:

dependencies:
  ...
  weighted_random:

Usage #

Import weighted_random.dart

import 'package:weighted_random/weighted_random.dart';

Example using

final List<String> stringList = ["a","b", "c", "d"];
final Map<String, dynamic> result = weightedRandom<String>(stringList, [40, 20, 60, 20]);

print(result);

Output

{item: b, index: 1}

Author #

Daisuke Takayama

5
likes
0
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

Weighted Random Algorithm for Dart libraries or applications.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on weighted_random