perturb method

num perturb(
  1. num position,
  2. num deltaPosition
)

Returns the next random number sampled from the interval obtained by intersecting: (start, end) and (position - deltaPosition, position + deltaPosition).

  • If the intersection is empty, double.nan is returned.
  • Returns a cached value if the cache is up-to-date.
  • If the cache is stale a new random number is returned and cached.

Implementation

num perturb(num position, num deltaPosition) => _perturb(
      position,
      deltaPosition,
    );