tModLoader v2023.01
A mod to make and play Terraria mods
Terraria.Utilities.WeightedRandom< T > Class Template Reference

Public Member Functions

 WeightedRandom (int seed)
 
 WeightedRandom (int seed, params Tuple< T, double >[] theElements)
 
 WeightedRandom (params Tuple< T, double >[] theElements)
 
 WeightedRandom (UnifiedRandom random)
 
 WeightedRandom (UnifiedRandom random, params Tuple< T, double >[] theElements)
 
void Add (T element, double weight=1.0)
 
void CalculateTotalWeight ()
 
void Clear ()
 
Get ()
 

Static Public Member Functions

static implicit operator T (WeightedRandom< T > weightedRandom)
 

Public Attributes

readonly List< Tuple< T, double > > elements = new List<Tuple<T, double>>()
 
bool needsRefresh = true
 
readonly UnifiedRandom random