Ejemplo n.º 1
0
        public static ColorChannelTransformation CreateRandomPolinomialChannelTransformation(Random random, Bounds coefficientBounds, double zeroChannelProbabilty)
        {
            double zeroChannel = random.NextDouble();
            if (zeroChannel < zeroChannelProbabilty)
                return new ColorChannelTransformation(0, 0, 0, 0);

            coefficientBounds = random.RandomlyShrinkBounds(coefficientBounds, 1);

            double a = Math.Round(random.NextDouble() * random.Next(coefficientBounds.Low, coefficientBounds.High), 2);
            double b = Math.Round(random.NextDouble() * random.Next(coefficientBounds.Low, coefficientBounds.High), 2);
            double c = Math.Round(random.NextDouble() * random.Next(coefficientBounds.Low, coefficientBounds.High), 2);

            if (a.Equals(0) && b.Equals(0) && c.Equals(0))
            {
                a = b = c = (coefficientBounds.High - coefficientBounds.Low) / 2.0;
            }

            double dispersionCoefficient = Math.Round(random.NextDouble() * 0.3, 2);
            return new ColorChannelTransformation(a, b, c, dispersionCoefficient);
        }
Ejemplo n.º 2
0
 public static Range[] CreateRandom(Random random, int variableCount, int iterationsCount, Bounds rangeBounds)
 {
     rangeBounds = random.RandomlyShrinkBounds(rangeBounds, 3);
     return EnumerableExtensions.Repeat(i => Range.CreateRandom(random, 1, rangeBounds.Low, rangeBounds.High, 1),variableCount).ToArray();
 }