Function generateFixedList

  • Generates a fixed list of specified length.

    Parameters

    • number: number

      The length of the list to be generated.

    • OptionalfixedValue: string | number

      An optional value to fill the list with. If not provided, the list will be filled with random alphanumeric strings of length 10.

    Returns (string | number)[]

    An array of the specified length, filled with either the fixed value or random alphanumeric strings.

    // Generates a list of 5 elements, all set to the fixed value 'A'
    const list1 = generateFixedList(5, 'A');
    // Output: ['A', 'A', 'A', 'A', 'A']
    // Generates a list of 3 elements, all set to the fixed value 42
    const list2 = generateFixedList(3, 42);
    // Output: [42, 42, 42]
    // Generates a list of 4 elements, each being a random alphanumeric string of length 10
    const list3 = generateFixedList(4);
    // Output: ['a1b2c3d4e5', 'f6g7h8i9j0', 'k1l2m3n4o5', 'p6q7r8s9t0']