/** * Helps with generating random numbers. */ export declare class Random { /** * The value this PRNG was seeded with. */ private _seed; /** * Retrieve the seed of the PRNG. * @returns The seed of the PRNG. */ get seed(): number; /** * The permutation table for simplex noise. */ private _perm; /** * The gradient map for simplex noise. */ private _gradP; /** * Skewing and unskewing factors for 2, 3, and 4 dimensions. */ private _F2; /** * Skewing and unskewing factors for 2, 3, and 4 dimensions. */ private _G2; /** * Creates a pseudo-random value generator. The seed must be an integer. * * Uses an optimized version of the Park-Miller PRNG. * http://www.firstpr.com.au/dsp/rand31/ * @param seed - The seed for the random number generator. */ constructor(seed?: number); /** * Returns a pseudo-random value between 1 and 2^32 - 2. * @returns A pseudo-random value between 1 and 2^32 - 2. */ next(): number; /** * Returns a random value in a given range. * @param min - The lower bound. * @param max - The upper bound. * @returns A random value between the lower and upper bound. */ nextRange(min: number, max: number): number; /** * Returns either `true` or `false`. * @returns Either `true` or `false`. */ nextBoolean(): boolean; /** * Returns a pseudo-random floating point number in range [0, 1). * @returns a pseudo-random floating point number in range [0, 1). */ nextFloat(): number; /** * Creates a new Random instance, with a seed that is based of the seed * of this Random instance. * @returns A new random number generator. */ nextRandom(): Random; static ALLOWED_CHARACTERS: string; /** * Returns a random ASCII string. * @param length - The length of the string. * @returns A random ASCII string. */ nextString(length: number, characters?: string): string; /** * Returns a 2D simplex noise value for a given input coordinate. * @param x - The X input coordinate. * @param y - The Y input coordinate. * @returns The noise value for the input coordinates. */ simplex2(x: number, y: number): number; /** * Returns a 3D simplex noise value for a given input coordinate. * @param x - The X input coordinate. * @param y - The Y input coordinate. * @param z - The Z input coordinate. * @returns The noise value for the input coordinates. */ simplex3(x: number, y: number, z: number): number; } /** * Returns a random value in a given range. * * Uses the JS-internal `Math.random()`. Use {@linkcode Random} for a PRNG with more features. * * Note that this method returns floating point numbers, regardless of your inputs potentially * being integers. If you require integers, ensure to truncate the resulting random value. * @param min - The lower bound. * @param max - The upper bound. * @returns A random value between the lower and upper bound. */ export declare const randomRange: (min: number, max: number) => number; /** * Generates a numberic seed, to be used as an input for a PRNG, * from a string. * @param input - The string to use as a seed. * @returns A numeric seed value for a PRNG. */ export declare const seedFromString: (input: string) => number; /** * A global PRNG instance that is ready-to-use. */ export declare const random: Random;