import random


def create_index_list(index_list_length, number_of_combinations):
    """ An index_list is a list of selected indexes.
        A selected index is a unique random number between the range [1, number_of_combinations] (both inclusive)

    Args:
        index_list_length (int): number of indexes to put into index_list (i.e. length of index_list)
        number_of_combinations (int): defines how many combinations of usernames, passwords, first_names, last_names and the phone numbers
                                      exist under TestData/ folder.

    Returns:
        list of integers: An index_list
    """
    index_list = []
    for j in range(1, index_list_length+1):
        # pick a unique selected_index, which is not in the index_list yet
        selected_index = random.randint(1, number_of_combinations)
        while selected_index in index_list: # if the selected_index is not unique, make it unique
            selected_index = random.randint(1, number_of_combinations)
        index_list.append(selected_index)
    return index_list