boundedRandom

@buff-beacon-project/rand-utils v1.0.0Docs


@buff-beacon-project/rand-utils v1.0.0 / boundedRandom

Function: boundedRandom()

boundedRandom(s, bitStream): number

Get an unbiased "random" number within the range [0, s) from a bitStream.

The "random" values are read from the provided bitStream. The function attempts to read as few bits as possible to achieve this.

Parameters

s: number

Upper bound (exclusive)

bitStream: BitStream

BitStream to read from

Returns

number

Defined in

random.ts:15

Last updated