This class can be used to pick a random item from a collection.
It can add to a collection of items that can be values of any type: strings, numbers, objects, etc.. Each item may have a probability weight.
The class can pick one or more random items from the collection. When picking multiple items it may allow repetition of the same item or assure that all the picked items are unique.
It can also pick random items considering their probability weight, so those with greater weight are more likely to be picked. |