Skip to content
On this page

Mersenne

Module to generate seed based random numbers.

rand

Generates a random number between [min, max).

Available since v5.5.0

Parameters

NameTypeDefaultDescription
maxnumber32768

The maximum number.

minnumber0

The minimum number.

Returns: number

ts
faker.mersenne.rand(max: number = 32768, min: number = 0): number
faker.mersenne.rand() // => 17983
faker.mersenne.rand() // 15515
faker.mersenne.rand(1000, 500) // 578

seed

Sets the seed to use.

Available since v5.5.0

Parameters

NameTypeDefaultDescription
Snumber

The seed to use.

Returns: void

ts
faker.mersenne.seed(S: number): void

seed_array

Sets the seed to use.

Available since v5.5.0

Parameters

NameTypeDefaultDescription
Anumber[]

The seed to use.

Returns: void

ts
faker.mersenne.seed_array(A: number[]): void

Released under the MIT License.