-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.ts
52 lines (51 loc) · 1.42 KB
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* The quick solution for everything random!
* A Gacha-like system to roll random items with weights.
*
* More weight = more common. Think of it as in terms of probability.
*
* ```js
* // deno.land
* import { GachaMachine } from "https://deno.land/x/fortuna/mod.ts"
* // JSR
* import { GachaMachine } from "jsr:@nekooftheabyss/[email protected]"
* // Node
* import { GachaMachine } from "@nekooftheabyss/fortuna"
* // esm.sh
* import { GachaMachine } from "https://esm.sh/jsr/@nekooftheabyss/[email protected]"
*
* const items = [
* { result: "SSR cool character", chance: 1 },
* { result: "Kinda rare character", chance: 3 },
* { result: "Mob character #1", chance: 5 },
* { result: "Mob character #2", chance: 5 },
* { result: "Mob character #3", chance: 5 },
* ]
*
* const machine = new GachaMachine(items)
*
* machine.get(10) // Rolls 10x
* ```
*
* My result:
* ```
* [
* "Kinda rare character",
* "Mob character #1",
* "Mob character #3",
* "Mob character #3",
* "Mob character #1",
* "Kinda rare character",
* "Mob character #2",
* "Mob character #2" ,
* "Mob character #1",
* "Mob character #2"
* ]
* ```
* @module
*/
export { GachaMachine } from "./src/machine.ts";
export { LimitedGachaMachine } from "./src/limited_machine.ts";
export { rollDie } from "./src/die.ts";
export { roll } from "./src/roll.ts";
export { unbiasedCoin } from "./src/coin.ts";