public static float Random(this IRandomizer randomizer, ICurveFunction curve, float minValue, float maxValue)
        {
            var randomNumber = randomizer.Random(minValue, maxValue);
            var isNegative   = minValue < 0;

            if (isNegative)
            {
                randomNumber = Math.Abs(randomNumber);
                maxValue     = Math.Abs(minValue);
            }

            var result = curve.ScaledPlot(randomNumber, maxValue);

            return(isNegative ? -result : result);
        }
Exemple #2
0
    public void should_scale_plot_correctly(ICurveFunction curve, float inputValue, float maxValue, float expectedValue)
    {
        var actualValue = curve.ScaledPlot(inputValue, maxValue);

        Assert.Equal(expectedValue, actualValue);
    }