Space Engineers
|
Contains items of any type. Each item has weight (float value). Allows to get item based on weight. More...
Public Member Functions | |
MyWeightDictionary (Dictionary< T, float > data) | |
Initializes a new instance of the MyWeightDictionary class. More... | |
float | GetSum () |
Gets sum of weights. More... | |
T | GetItemByWeightNormalized (float weightNormalized) |
Gets item based on weight. More... | |
T | GetItemByWeight (float weight) |
Gets item based on weight. More... | |
T | GetRandomItem (Random rnd) |
Gets random item based on weight. More... | |
Properties | |
int | Count [get] |
Contains items of any type. Each item has weight (float value). Allows to get item based on weight.
T | The item type |
Definition at line 13 of file MyWeightDictionary.cs.
|
inline |
Initializes a new instance of the MyWeightDictionary class.
data | Dictionary with items and weights. |
Definition at line 22 of file MyWeightDictionary.cs.
|
inline |
Gets item based on weight.
weight | Weight, value from 0 to sum. |
Definition at line 64 of file MyWeightDictionary.cs.
|
inline |
Gets item based on weight.
weightNormalized | Weight, value from 0 to 1. |
Definition at line 54 of file MyWeightDictionary.cs.
|
inline |
Gets random item based on weight.
Definition at line 82 of file MyWeightDictionary.cs.
|
inline |
Gets sum of weights.
Definition at line 44 of file MyWeightDictionary.cs.
|
get |
Definition at line 33 of file MyWeightDictionary.cs.