/// <summary>
        /// Return a value based on the weights provided.
        /// </summary>
        /// <returns></returns>
        public T1 GetNext()
        {
            if (this.Provider == null)
            {
                this.Provider = UnityRandomizationProvider.Default;
            }

            if (!_adjusted)
            {
                this.CalculateAdjustedWeights();
            }

            double d    = this.Provider.NextRandomValue();
            var    item = this._weights.FirstOrDefault(x => d <= x.AdjustedWeight);

            return(item.Value);
        }
Ejemplo n.º 2
0
 public DiceRoller(IRandomizationProvider rand)
 {
     _rand = rand;
 }