triangular static method

num triangular(
  1. num p,
  2. num xMin,
  3. num xMax
)

Returns the inverse cummulative distribution of the coordinate x of a two-dimensional search space with triangular geometry. The search space:

  • Extends from xMin to xMax along the horizontal axis.
  • Has zero extent in y-direction if the first coordinate is xMin.
  • Extends from yMin to yMax if the first corrdinate is xMax.
  • p is a probability with value 0...1.

Implementation

static num triangular(num p, num xMin, num xMax) =>
    xMin + (xMax - xMin) * sqrt(p);