An open API service indexing awesome lists of open source software.

https://github.com/ybda/randomprobability

Demo of how you can generate random numbers based on a set of given probabilities for a range of numbers.
https://github.com/ybda/randomprobability

Last synced: about 2 months ago
JSON representation

Demo of how you can generate random numbers based on a set of given probabilities for a range of numbers.

Awesome Lists containing this project

README

          

# RandomProbability

Demo of how you can generate random numbers based on a set of given probabilities for a range of numbers.

## Print

Probabilites (key is number, value is number's probability)

```json
{ 2, 0.005 },
{ 3, 0.4 },
{ 4, 0.5 },
```

Result (the first object shows how many numbers and the second object shows their percentage)

```json
{
"0": 1355,
"1": 1331,
"2": 485,
"3": 39896,
"4": 49978,
"5": 1414,
"6": 1384,
"7": 1388,
"8": 1385,
"9": 1384
}
{
"0": 0.01355,
"1": 0.01331,
"2": 0.00485,
"3": 0.39896,
"4": 0.49978,
"5": 0.01414,
"6": 0.01384,
"7": 0.01388,
"8": 0.01385,
"9": 0.01384
}
```