ngneat / falso

All the Fake Data for All Your Real Needs 🙂

Home Page:https://ngneat.github.io/falso/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Percentages that add up to 100% together

PumpedSardines opened this issue · comments

Description

A way to generate multiple percentages that together add up to 100%

For example, on GitHub you have a graph showing what percentage of your contributions to GitHub are issues, commits, PR and Code Review. These all add up to 100%.

Proposed solution

const [one,two,three,four] = falso.randPercentages({ amount: 4, fractions: 3 });
console.log(one + two + three + four); // Should output 1

Alternatives considered

No response

Do you want to create a pull request?

No

Has been merged