@jitsi/js-utils
Version:
Utilities for Jitsi JS projects
39 lines (38 loc) • 1.33 kB
TypeScript
/**
* Generate a string with random alphanumeric characters with a specific length.
*
* @param {number} length - The length of the string to return.
* @returns {string} A string of random alphanumeric characters with the
* specified length.
*/
export declare function randomAlphanumString(length: number): string;
/**
* Get random element of array or string.
*
* @param {Array|string} arr - Source.
* @returns {Array|string} Array element or string character.
*/
export declare function randomElement<T>(arr: readonly T[]): T;
export declare function randomElement(arr: string): string;
/**
* Returns a random hex digit.
*
* @returns {Array|string}
*/
export declare function randomHexDigit(): string;
/**
* Generates a string of random hexadecimal digits with a specific length.
*
* @param {number} length - The length of the string to return.
* @returns {string} A string of random hexadecimal digits with the specified
* length.
*/
export declare function randomHexString(length: number): string;
/**
* Generates random int within the range [min, max].
*
* @param {number} min - The minimum value for the generated number.
* @param {number} max - The maximum value for the generated number.
* @returns {number} Random int number.
*/
export declare function randomInt(min: number, max: number): number;