from Fortuna import *
import math as _math
import random as _random


def quick_test():
    print("\nFortuna Test Suite: RNG Storm Engine")
    print("\nTruffleShuffle")
    some_list = [i for i in range(11)]
    truffle_shuffle = TruffleShuffle(some_list)
    distribution_timer(truffle_shuffle)
    print(f"\nQuantumMonty({some_list})")
    quantum_monty = QuantumMonty(some_list)
    distribution_timer(quantum_monty.uniform)
    distribution_timer(quantum_monty.front)
    distribution_timer(quantum_monty.back)
    distribution_timer(quantum_monty.middle)
    distribution_timer(quantum_monty.quantum)
    distribution_timer(quantum_monty.front_gauss)
    distribution_timer(quantum_monty.back_gauss)
    distribution_timer(quantum_monty.middle_gauss)
    distribution_timer(quantum_monty.quantum_gauss)
    distribution_timer(quantum_monty.front_poisson)
    distribution_timer(quantum_monty.back_poisson)
    distribution_timer(quantum_monty.middle_poisson)
    distribution_timer(quantum_monty.quantum_poisson)
    distribution_timer(quantum_monty.quantum_monty)
    print("\nWeighted Choice")
    population = [36, 30, 24, 18]
    cum_weights = [1, 10, 100, 1000]
    rel_weights = [1, 9, 90, 900]
    print("Base Case")
    distribution_timer(_random.choices, population, cum_weights=cum_weights)
    cum_weighted_choice = CumulativeWeightedChoice(zip(cum_weights, population))
    distribution_timer(cum_weighted_choice)
    print("Base Case")
    distribution_timer(_random.choices, population, weights=rel_weights)
    cum_weighted_choice = RelativeWeightedChoice(zip(rel_weights, population))
    distribution_timer(cum_weighted_choice)
    print("\nFlexCat")
    some_dict = {1: [1, 2, 3], 2: [10, 20, 30], 3: [100, 200, 300]}
    flex_cat = FlexCat(some_dict)
    distribution_timer(flex_cat)
    print("\nRandom Integers")
    print("Base Case")
    distribution_timer(_random.randrange, 10)
    distribution_timer(randbelow, 10)
    print("Base Case")
    distribution_timer(_random.randint, -5, 5)
    distribution_timer(randint, -5, 5)
    print("Base Case")
    distribution_timer(_random.randrange, 1, 21, 2)
    distribution_timer(randrange, 1, 21, 2)
    distribution_timer(d, 10)
    distribution_timer(dice, 2, 6)
    distribution_timer(plus_or_minus, 5)
    distribution_timer(binomial, 4, 0.5)
    distribution_timer(negative_binomial, 5, 0.75)
    distribution_timer(geometric, 0.75)
    distribution_timer(poisson, 4.5)
    distribution_timer(discrete, 7, 1, 30, 1)
    print("\nRandom Floats")
    distribution_timer(random, post_processor=round)
    distribution_timer(uniform, 0.0, 10.0, post_processor=_math.floor)
    distribution_timer(expovariate, 1.0, post_processor=_math.floor)
    distribution_timer(gammavariate, 2.0, 1.0, post_processor=round)
    distribution_timer(weibullvariate, 1.0, 1.0, post_processor=_math.floor)
    distribution_timer(betavariate, 3.0, 3.0, post_processor=round)
    distribution_timer(paretovariate, 4.0, post_processor=_math.floor)
    distribution_timer(gauss, 1.0, 1.0, post_processor=round)
    distribution_timer(normalvariate, 0.0, 2.8, post_processor=round)
    distribution_timer(lognormvariate, 0.0, 0.5, post_processor=round)
    distribution_timer(vonmisesvariate, 0, 0, post_processor=_math.floor)
    distribution_timer(triangular, 0.0, 10.0, 0.0, post_processor=_math.floor)
    distribution_timer(extreme_value, 0.0, 1.0, post_processor=round)
    distribution_timer(chi_squared, 1.0, post_processor=lambda x: _math.floor(x) % 10)
    distribution_timer(cauchy, 0.0, 1.0, post_processor=lambda x: _math.floor(x) % 10)
    distribution_timer(fisher_f, 8.0, 8.0, post_processor=lambda x: _math.floor(x) % 10)
    distribution_timer(student_t, 8.0, post_processor=round)
    print("\nRandom Booleans")
    distribution_timer(percent_true, 33.33)
    print("\nRandom Shuffles")
    some_list = [i for i in range(1, 11)]
    print(f"Timer only: shuffle(some_list) of size {len(some_list)}:")
    timer(shuffle, some_list)
    print()
    some_list = [i for i in range(1, 11)]
    print(f"Timer only: knuth(some_list) of size {len(some_list)}:")
    timer(knuth, some_list)
    print()
    some_list = [i for i in range(1, 11)]
    print(f"Timer only: fisher_yates(some_list) of size {len(some_list)}:")
    timer(fisher_yates, some_list)
    print()
    print("\nRandom Values")
    some_list = [i for i in range(1, 11)]
    print("Base Case")
    distribution_timer(_random.choice, some_list)
    distribution_timer(random_value, some_list)


if __name__ == "__main__":
    quick_test()
