Exemplo n.º 1
0
    //
    public WeightedRandomCollection <T> WeightedBag <T>(T[] values, float[] initalWeights)
    {
        var result = new WeightedRandomCollection <T>(this);

        for (var n = 0; n < values.Length; ++n)
        {
            result.Apply(values[n], initalWeights[n]);
        }

        return(result);
    }
Exemplo n.º 2
0
    //
    public WeightedRandomCollection <T> WeightedBag <T>(T[] values, float initalWeight)
    {
        var result = new WeightedRandomCollection <T>(this);

        foreach (var n in values)
        {
            result.Apply(n, initalWeight);
        }

        return(result);
    }