Skip to content

@emile/engine


@emile/engine / math/random / bellWeightedRandomInt

Function: bellWeightedRandomInt()

bellWeightedRandomInt(min, max, dice): number

Defined in: src/math/random.ts:42

Generates a random integer between min and max, with an approximate bell curve distribution.

Parameters

min

number

The minimum value (inclusive).

max

number

The maximum value (exclusive).

dice

number = 20

The number of dice to roll, this is the accuracy of the bell curve distribution.

Returns

number

The random number.

Note

uses bellWeightedRandomFloat to generate a float and then floors it to get an integer.