Skip to content

Type Alias: Distribution ​

ts
type Distribution = object;

Defined in: src/odds.ts:19

Exact odds for a spec, worked out rather than simulated: every total the dice can make and how likely it is.

Plain dice are counted. Ten d1000 is a million million million million million outcomes, far past what a number holds exactly, so the counts are kept as BigInt, whole and exact however large, and only turned into a probability at the end. exactCounts hands those counts out. Rerolled and exploding dice, and several dice kept from a pool, are not equally likely outcomes to count, so they are worked out as probabilities instead and are right to the last few digits a number holds. Nothing here is sampled or rounded off, and nothing is left out: exploding dice stop at MAX_EXPLOSIONS, in the roll and in the odds alike, so the odds are those of the dice as they are really thrown.

Properties ​

min ​

ts
min: number;

Defined in: src/odds.ts:21

The lowest total the dice can make.


max ​

ts
max: number;

Defined in: src/odds.ts:23

The highest total the dice can make.


probabilities ​

ts
probabilities: number[];

Defined in: src/odds.ts:25

probabilities[i] is the chance of a total of min + i. Sums to 1.

MIT © John Morris