wrap static method

num wrap(
  1. num n,
  2. num min,
  3. num max
)

Wraps the given value into the inclusive-exclusive interval between min and max. n The value to wrap.

min The minimum.

max The maximum.

Implementation

/// [n]   The value to wrap.
///
/// [min] The minimum.
///
/// [max] The maximum.
static num wrap(num n, num min, num max) =>
    (n >= min && n < max) ? n : (mod(n - min, max - min) + min);