import random
import time


def gen_unique_randoms(num, prime):
    """Generates a unique list of random numbers where the list has length
    num. Every generated value is in the range [1, prime-1]

    Args:
        num: The number of elements to be generated
        prime: The upper bound of the range to be generated.

    Returns:
        A list of random numbers where each number is in
        the range [1, prime-1].
    """

    elements = list()
    rng = random.SystemRandom(int(time.time()))
    generated = 0
    while generated != num:
        rnd = rng.randint(1, prime - 1)
        if rnd not in elements:
            elements.extend([rnd])
            generated += 1
    assert len(elements) == num
    return elements