All files / src dataGeneration.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 3/3
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20          2x 2x 20x                   2x 1x  
/**
 * Generates a random byte array in hexadecimal value.
 *
 * @param size The size of the hex string in bytes.
 */
export const generateRandomHexString = (size: number) =>
  [...Array.from({ length: size })]
    .map(() => Math.floor(Math.random() * 16).toString(16))
    .join('')
    .toLowerCase();
 
/**
 * Generates a random BigInt number between two values.
 *
 * @param min The minimum value.
 * @param max The maximum value.
 */
export const generateRandomBigInt = (min: number, max: number): bigint =>
  BigInt(Math.floor(Math.random() * (max + 1 - min) + min));