Normalises an array. By default uses the actual min/max of the array as the normalisation range. ixfx Guide on Normalising

import {Normalise} from 'https://unpkg.com/ixfx/dist/numbers.js'
// Yields: [0.5, 0.1, 0.0, 0.9, 1]
Normalise.array([5,1,0,9,10]);

minForced and/or maxForced can be provided to use an arbitrary range.

// Forced range 0-100
// Yields: [0.05, 0.01, 0.0, 0.09, 0.10]
Normalise.array([5,1,0,9,10], 0, 100);

Return values are clamped to always be 0-1, inclusive.

  • Parameters

    • values: readonly number[]

      Values

    • OptionalminForced: number

      If provided, this will be min value used

    • OptionalmaxForced: number

      If provided, this will be the max value used

    Returns number[]