roundom
v1.0.1
Published
Round an array, conserving both sum and individual expected values
Downloads
3
Maintainers
Readme
roundom
Round an array, conserving both sum and individual expected value.
Usage
Install the library with npm install roundom
import roundom from 'roundom';
console.log(roundom([1, 0.9, -1.9]); // <- [1, 1, -2] (90%) or [1, 0, -1] (10%)
console.log(roundom([1, 0.9, -1.9], 0.1); // <- [1, 1, -2] (100%) given fixed seed