コード例 #1
0
ファイル: Randm.cs プロジェクト: sethjuarez/numlsample
        public object PickOne(params WeightedOption[] weightedOptions)
        {
            var castedOptions = weightedOptions.Select(wo => WeightedOption <object> ._(wo.Weight, wo.Obj));
            var result        = PickOne <object>(castedOptions.ToArray());

            return(result);
        }
コード例 #2
0
ファイル: Randm.cs プロジェクト: sethjuarez/numlsample
        public static WeightedOption <T> _(double weight, T obj)
        {
            var result = new WeightedOption <T>()
            {
                Weight = weight,
                Obj    = obj
            };

            return(result);
        }