drop-rate
v1.0.4
Published
The solution for drop rates !
Downloads
1
Maintainers
Readme
Description
Drop-rate is a package for calculating probabilities through ratios
Installation
npm i drop-rate
yarn add drop-rate
Usage
import random from 'drop-rate'
const rates = [
{ name: "R", rate: 60 },
{
name: "SR",
rate: 33.5,
},
{
name: "SSR",
rate: 5,
},
{
name: "LSSR",
rate: 1,
},
{
name: "UR",
rate: 0.5,
}
]
const result = random.calculate(rates)
// {name: "R", rate: 60 }
> Make sure total rate is equal `100` percents
If you want to use more:
const rates = [
{ name: "R", rate: 60, other: any },
{
name: "SR",
rate: 33.5,
other: any,
},
...
]
const result = random.calculate(rates)
// {name: "R", rate: 60, other: any }
Contributing
@Medium_Hieu https://github.com/bachtuyetx7chulun