Skip to content
0

katanakit-js / useFakeSeed

Function: useFakeSeed() ​

ts
function useFakeSeed(seed?): Promise<number>;

Defined in: src/core/services/faker.service.ts:51

Seeds the faker instance for reproducible output, or rolls a new random seed.

The sequence depends on the seed, the number of calls made since it was set and the faker major version — keep the call order stable for stable output.

Parameters ​

ParameterTypeDescription
seed?numberOptional numeric seed. Omit it to generate a fresh random seed (log the returned value and pass it back later to replay the exact run).

Returns ​

Promise<number>

The seed that was set.

Example ​

ts
import { useFakeSeed, useFakeUuid } from "katanakit-js";

const seed = await useFakeSeed(); // random, but loggable/replayable
await useFakeSeed(seed);          // replays the same sequence
await useFakeUuid();

Released under the MIT License.