roundom

1.0.1 • Public • Published

roundom

NPM version Downloads

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

Package Sidebar

Install

npm i roundom

Weekly Downloads

2

Version

1.0.1

License

Apache-2.0

Unpacked Size

16 kB

Total Files

9

Last publish

Collaborators

  • dleshem