def subsample(input_list, sample_size, rnd_generator):
    """Returns a list that is a random subsample of the input list.

    Args:
        input_list: List of elements of any type
        sample_size: Int. How many elements of input_list should be in the output list
        rnd_generator: initialized random generator object (built by np.random.default_rng(...))
    Returns:
        List. A random subsample of input_list

    """
    size = min(len(input_list), sample_size)

    # 'replace=False' ensures that there will be no repetitions in indexes
    indexes = rnd_generator.choice(len(input_list), size=size, replace=False)

    res = []
    for ind in indexes:
        res.append(input_list[ind])
    return res