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.
- Host: GitHub
- URL: https://github.com/ybda/randomprobability
- Owner: ybda
- License: gpl-3.0
- Created: 2024-05-09T15:50:16.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-09T16:13:05.000Z (about 2 years ago)
- Last Synced: 2025-12-26T13:49:36.194Z (6 months ago)
- Language: C#
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
}
```