import random
import math


def random_hash_function(bins: int, num_business: int):
    """Randomly generate parameters for hash function and generate a empty signature matrix
    :parameter bins: length of unique user_id which is also total number of records
    :parameter num_business: length of unique business_id
    :returns parameters, signature_matrix
    """
    hash_size = 1000                                                     # Number of hash functions
    num_a = [random.randrange(bins) for _ in range(hash_size)]   # Parameter a for hash function
    num_b = [random.randrange(bins) for _ in range(hash_size)]   # Parameter b for hash function
    bins = math.ceil(math.sqrt(bins))                                   # Mod by bins

    # Combined parameters for each hash function
    parameters = [(num_a[i], num_b[i], 40) for i in range(hash_size)]
    # Generate empty signature matrix with inf number
    empty_h = [[float('inf') for _ in range(len(parameters))] for _ in range(num_business)]

    return parameters, empty_h