|
Inventory Engine v4.2
|
A class to use to get more controlled randomness, taking values out of the bag randomly, and never getting them again. More...
Public Member Functions | |
| MMShufflebag (int initialCapacity) | |
| Initializes the shufflebag. | |
| virtual void | Add (T item, int quantity) |
| Adds the specified quantity of the item to the bag. | |
| T | Pick () |
| Returns a random item from the bag. | |
Protected Attributes | |
| List< T > | _contents |
| T | _currentItem |
| int | _currentIndex = -1 |
Properties | |
| virtual int | Capacity [get] |
| virtual int | Size [get] |
A class to use to get more controlled randomness, taking values out of the bag randomly, and never getting them again.
Usage :
var shuffleBag = new ShuffleBag(40); for (int i = 0; i<40; i++) { newValue = something; shuffleBag.Add(newValue, amount); }
then : float something = shuffleBag.Pick();
|
virtual |
Adds the specified quantity of the item to the bag.
| item | |
| quantity |
| MoreMountains.Tools.MMShufflebag< T >.MMShufflebag | ( | int | initialCapacity | ) |
Initializes the shufflebag.
| initialCapacity |
| T MoreMountains.Tools.MMShufflebag< T >.Pick | ( | ) |
Returns a random item from the bag.
|
protected |
|
protected |
|
protected |
|
get |
|
get |