https://github.com/eminmuhammadi/randomchance
Randomizer with Percentages (Javascript)
https://github.com/eminmuhammadi/randomchance
js randomizer roulette roulette-wheel-algorithm
Last synced: 5 months ago
JSON representation
Randomizer with Percentages (Javascript)
- Host: GitHub
- URL: https://github.com/eminmuhammadi/randomchance
- Owner: eminmuhammadi
- License: mit
- Created: 2020-05-22T20:04:05.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-07-05T20:15:01.000Z (almost 5 years ago)
- Last Synced: 2024-05-01T16:11:30.266Z (about 2 years ago)
- Topics: js, randomizer, roulette, roulette-wheel-algorithm
- Language: HTML
- Homepage: https://eminmuhammadi.github.io/RandomChance/example/
- Size: 4.42 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RandomChance
Randomizer with Percentages. For DEMO => [https://eminmuhammadi.github.io/RandomChance/example/index.html](https://eminmuhammadi.github.io/RandomChance/example/index.html)
## Installing
```html
```
## Example
Code:
```js
var Chest =
{
items: ['diamond','gold','iron','coal','stone'],
chances: [3,7,15,25,50]
}
var RC = new RandomChance(Chest.items,Chest.chances);
var Result = RC.Spin();
console.log(Result);
```
Result:
```
stone
```
## Chances Example
Code:
```js
var Chest =
{
items: ['diamond','gold','iron','coal','stone'],
chances: [3,7,15,25,50]
}
var RC = new RandomChance(Chest.items,Chest.chances);
console.log(RC.LookThrough());
```
Result:
```js
(5) [Array(2), Array(2), Array(2), Array(2), Array(2)]
0: (2) ["diamond", 3]
1: (2) ["gold", 7]
2: (2) ["iron", 15]
3: (2) ["coal", 25]
4: (2) ["stone", 50]
length: 5
__proto__: Array(0)
```