def random_number_lower_endian(length, base):
    'Helper function: generate a random number as a lower-endian digits list.'
    if (length == 1):
        return [np.random.randint(base)]
    prefix = [np.random.randint(base) for _ in range((length - 1))]
    return (prefix + [(np.random.randint((base - 1)) + 1)])
Helper function: generate a random number as a lower-endian digits list.
def random_number_lower_endian(length, base):
    
    if (length == 1):
        return [np.random.randint(base)]
    prefix = [np.random.randint(base) for _ in range((length - 1))]
    return (prefix + [(np.random.randint((base - 1)) + 1)])