PiMath API
    Preparing search index...

    Interface RandomCoefficientConfig

    Options of rndFraction.

    interface RandomCoefficientConfig {
        allow?: { negative?: boolean; positive?: boolean; zero?: boolean };
        max?: number;
        range?: RandomRange;
        reduced?: boolean;
        relative?: boolean;
    }
    Index
    allow?: { negative?: boolean; positive?: boolean; zero?: boolean }

    Type Declaration

    • Optionalnegative?: boolean

      Allow negative values (default true).

    • Optionalpositive?: boolean

      Allow positive values (default true). With negative: false and zero left to false nothing is left: it throws.

    • Optionalzero?: boolean

      Allow the value 0 (default false).

    max?: number

    Bound (absolute value) of the numerator and of the denominator (default 10).

    range?: RandomRange

    Interval of the value: a number d means [-|d|, |d|], {min, max} gives explicit bounds (default: none, the value is only bounded by max). Combined with allow: a sign is possible only if the interval holds values of that sign. max then defaults to the largest bound of the interval, at least 2 (doubled when the interval stays at least 1 away from 0), so that a small interval still gets fractions. Where a generator drives the interval itself (the coordinates of a point, the radius…), its own interval replaces this one.

    reduced?: boolean

    Reduce the fraction (default true).

    relative?: boolean

    true forces an integer of either sign (denominator 1): the name follows Fraction.isRelative() (a "natural" number would be non-negative). Default false.