# Fortuna: Random Value Generator
Fortuna's main goal is to provide a quick and easy way to build custom random generators that don't suck.

The core functionality of Fortuna is based on the RNG Storm engine. While Storm is a high quality random engine, Fortuna is not appropriate for cryptography of any kind. Fortuna is meant for games, data science, A.I. and experimental programming, not security.

Suggested Installation: `$ pip install Fortuna`

Installation on platforms other than MacOS may require building from source files.


### Documentation Table of Contents:
- Random Value Generators
    - `TruffleShuffle(Sequence) -> Callable`
    - `QuantumMonty(Sequence) -> Callable`
    - `CumulativeWeightedChoice(Table) -> Callable`
    - `RelativeWeightedChoice(Table) -> Callable`
    - `FlexCat(Matrix) -> Callable`
- Random Integer Functions
    - `randbelow(Integer) -> Integer`
    - `randint(Integer, Integer) -> Integer`
    - `randrange(Integer, Integer, Integer) -> Integer`
    - `d(Integer) -> Integer`
    - `dice(Integer, Integer) -> Integer`
    - `plus_or_minus(Integer) -> Integer`
    - `binomial(number_of_trials: int, probability: float) -> int`
    - `negative_binomial(trial_successes: int, probability: float) -> int`
    - `geometric(probability: float) -> int`
    - `poisson(mean: float) -> int`
    - `discrete(count: int, xmin: int, xmax: int) -> int`
- Random Float Functions
    - `random() -> float`
    - `uniform(a: float, b: float) -> float`
    - `expovariate(lambd: float) -> float`
    - `gammavariate(alpha, beta) -> float`
    - `weibullvariate(alpha, beta) -> float`
    - `betavariate(alpha, beta) -> float`
    - `paretovariate(alpha) -> float`
    - `gauss(mu: float, sigma: float) -> float`
    - `normalvariate(mu: float, sigma: float) -> float`
    - `lognormvariate(mu: float, sigma: float) -> float`
    - `vonmisesvariate(mu: float, kappa: float) -> float`
    - `triangular(low: float, high: float, mode: float = None)`
    - `extreme_value(location: float, scale: float) -> float`
    - `chi_squared(degrees_of_freedom: float) -> float`
    - `cauchy(location: float, scale: float) -> float`
    - `fisher_f(degrees_of_freedom_1: float, degrees_of_freedom_2: float) -> float`
    - `student_t(degrees_of_freedom: float) -> float`
- Random Bool Function
    - `percent_true(Float) -> Bool`
- Random Shuffle Functions
    - `shuffle(array: list) -> None`
    - `knuth(array: list) -> None`
    - `fisher_yates(array: list) -> None`
- Test Suite Functions
    - `distribution_timer(func: staticmethod, *args, **kwargs) -> None`
    - `quick_test()`
- Test Suite Output
    - Distributions and performance data from the most recent build.
- Development Log
- Legal Information

##### Project Definitions:
- Integer: 64 bit signed long long int.
    - Input & Output Range: `(-2**63, 2**63)` or approximately +/- 9.2 billion billion.
    - Minimum: -9223372036854775807
    - Maximum:  9223372036854775807
- Float: 64 bit double precision real number.
    - Minimum: -1.7976931348623157e+308
    - Maximum:  1.7976931348623157e+308
    - Iota Below Zero: -5e-324
    - Iota Above Zero:  5e-324
- Value: Any python object that can be put inside a list: str, int, and lambda to name a few. Almost anything.
- Callable: Any function, method or lambda.
- Sequence: Any object that can be converted into a list.
    - List, Tuple, Set, etc...
    - Comprehensions and Generators that produce Sequences also qualify.
- Array: List or tuple.
    - Must be indexed like a list.
    - List comprehensions are ok, but sets and generators are not indexed.
    - All arrays are sequences but not all sequences are arrays.
    - Classes that wrap a list will take any Sequence or Array and copy it or convert it as needed.
    - Functions that operate on a list will require an Array.
- Pair: Sequence of two values.
- Table: Sequence of Pairs.
    - List of lists of two values each.
    - Tuple of tuples of two values each.
    - Generators that produce Tables also qualify.
    - The result of zip(list_1, list_2) also qualifies.
- Matrix: Dictionary of Sequences.
    - Generators that produce Matrices also qualify.


## Random Value Classes
### TruffleShuffle
`TruffleShuffle(list_of_values: Sequence) -> callable`
- The input Sequence can be any list like object (list, set, tuple or generator).
- The input Sequence must not be empty. Values can be any python object.
- The returned callable produces a random value from the list with a wide uniform distribution.

#### TruffleShuffle, Basic Use Case
```python
from Fortuna import TruffleShuffle


list_of_values = [1, 2, 3, 4, 5, 6]

truffle_shuffle = TruffleShuffle(list_of_values)

print(truffle_shuffle())  # prints a random value from the list_of_values.
```

**Wide Uniform Sequence**: *"Wide"* refers to the average distance between consecutive occurrences of the same item in the output sequence. The goal of this type of distribution is to keep the output sequence free of clumps while maintaining randomness and the uniform probability of each value.

This is not the same as a *flat uniform distribution*. The two distributions will be statistically similar, but the output sequences are very different. For a more general solution that offers several statistical distributions, please refer to QuantumMonty. For a more custom solution featuring discrete rarity refer to RelativeWeightedChoice and its counterpart CumulativeWeightedChoice.

**Micro-shuffle**: This is the hallmark of TruffleShuffle and how it creates a wide uniform distribution efficiently. While adjacent duplicates are forbidden, nearly consecutive occurrences of the same item are also required to be extremely rare with respect to the size of the set. This gives rise to output sequences that seem less mechanical than other random sequences. Somehow more and less random at the same time, almost human-like?

**Automatic Flattening**: TruffleShuffle and all higher-order Fortuna classes will recursively unpack callable objects returned from the data set at call time. Automatic flattening is dynamic, lazy, fault tolerant and on by default. Un-callable objects or those that require arguments will be returned in an uncalled state without error. A callable object can be any class, function, method or lambda. Mixing callable objects with un-callable objects is fully supported. Nested callable objects are fully supported. It's lambda all the way down.

To disable automatic flattening, pass the optional argument flat=False during instantiation.

Please review the code examples of each section. If higher-order functions and lambdas make your head spin, concentrate only on the first example of each section. Because `lambda(lambda) -> lambda` fixes everything for arbitrary values of 'because', 'fixes' and 'everything'.


#### Flattening
```python
from Fortuna import TruffleShuffle


flatted = TruffleShuffle([lambda: 1, lambda: 2])
print(flatted())  # will print the value 1 or 2

un_flat = TruffleShuffle([lambda: 1, lambda: 2], flat=False)
print(un_flat()())  # will print the value 1 or 2, mind the double-double parenthesis

auto_un_flat = TruffleShuffle([lambda x: x, lambda x: x + 1])
# flat=False is not required here because the lambdas can't be called without input x satisfied.
print(auto_un_flat()(1))  # will print the value 1 or 2, mind the double-double parenthesis

```


#### Mixing Static Objects with Callable Objects
```python
from Fortuna import TruffleShuffle


mixed_flat = TruffleShuffle([1, lambda: 2])
print(mixed_flat())  # will print 1 or 2

mixed_un_flat = TruffleShuffle([1, lambda: 2], flat=False) # not recommended.
print(mixed_flat())  # will print 1 or <lambda at some_address>
# This pattern is not recommended because you wont know the nature of what you get back.
# This is almost always not what you want, and always messy.
```


##### Dynamic Strings
To successfully express a dynamic string, at least one level of indirection is required.
Without an indirection the f-string would collapse into a static string too soon.

WARNING: The following example features a higher order function that takes a tuple of lambdas and returns a higher order function that returns a random lambda that returns a dynamic f-string.

```python
from Fortuna import TruffleShuffle, d


# d is a simple dice function.
brainiac = TruffleShuffle((
    lambda: f"A{d(2)}",
    lambda: f"B{d(4)}",
    lambda: f"C{d(6)}",
))

print(brainiac())  # prints a random dynamic string.
```


### QuantumMonty
`QuantumMonty(some_list: Sequence) -> callable`
- The input Sequence can be any list like object (list, set, tuple or generator).
- The input Sequence must not be empty. Values can be any python object.
- The returned callable will produce random values from the list using the selected distribution model or "monty".
- The default monty is the Quantum Monty Algorithm.

```python
from Fortuna import QuantumMonty


list_of_values = [1, 2, 3, 4, 5, 6]
quantum_monty = QuantumMonty(list_of_values)

print(quantum_monty())          # prints a random value from the list_of_values.
                                # uses the default Quantum Monty Algorithm.

print(quantum_monty.uniform())  # prints a random value from the list_of_values.
                                # uses the "uniform" monty: a flat uniform distribution.
                                # equivalent to random.choice(list_of_values) but better.
```
The QuantumMonty class represents a diverse collection of strategies for producing random values from a sequence where the output distribution is based on the method you choose. Generally speaking, each value in the sequence will have a probability that is based on its position in the sequence. For example: the "front" monty produces random values where the beginning of the sequence is geometrically more common than the back. Given enough samples the "front" monty will always converge to a 45 degree slope down for any list of unique values.

There are three primary method families: geometric, gaussian, and poisson. Each family has three base methods; 'front', 'middle', 'back', plus a 'quantum' method that incorporates all three base methods. The quantum algorithms for each family produce distributions by overlapping the probability waves of the other methods in their family. The Quantum Monty Algorithm incorporates all nine base methods.

In addition to the thirteen positional methods that are core to QuantumMonty, it also implements a uniform distribution as a simple base case.

**Automatic Flattening**: All higher-order Fortuna classes will recursively unpack callable objects returned from the data set at call time. Automatic flattening is dynamic, lazy, fault tolerant and on by default. Un-callable objects or those that require arguments will be returned in an uncalled state without error.

```python
import Fortuna


quantum_monty = Fortuna.QuantumMonty(
    ["Alpha", "Beta", "Delta", "Eta", "Gamma", "Kappa", "Zeta"]
)

""" Each of the following methods will return a random value from the sequence.
Each method has its own unique distribution model for the same data set. """

""" Flat Base Case """
quantum_monty.uniform()             # Flat Uniform Distribution

""" Geometric Positional """
quantum_monty.front()               # Geometric Descending, Triangle
quantum_monty.middle()              # Geometric Median Peak, Equilateral Triangle
quantum_monty.back()                # Geometric Ascending, Triangle
quantum_monty.quantum()             # Geometric Overlay, Saw Tooth

""" Gaussian Positional """
quantum_monty.front_gauss()         # Exponential Gamma
quantum_monty.middle_gauss()        # Scaled Gaussian
quantum_monty.back_gauss()          # Reversed Gamma
quantum_monty.quantum_gauss()       # Gaussian Overlay

""" Poisson Positional """
quantum_monty.front_poisson()       # 1/3 Mean Poisson
quantum_monty.middle_poisson()      # 1/2 Mean Poisson
quantum_monty.back_poisson()        # 2/3 Mean Poisson
quantum_monty.quantum_poisson()     # Poisson Overlay

""" Quantum Monty Algorithm """
quantum_monty.quantum_monty()       # Quantum Monty Algorithm

```

### Weighted Choice: Custom Rarity
Weighted Choice offers two strategies for selecting random values from a sequence where programmable rarity is desired. Both produce a custom distribution of values based on the weights of the values.

Flatten: Both will recursively unpack callable objects returned from the data set. Callable objects that require arguments are returned in an uncalled state. To disable this behavior pass the optional argument flat=False during instantiation. By default flat=True.

- Constructor takes a copy of a sequence of weighted value pairs... `[(weight, value), ... ]`
- Automatically optimizes the sequence for correctness and optimal call performance for large data sets.
- The sequence must not be empty, and each pair must contain a weight and a value.
- Weights must be positive integers.
- Values can be any Python object that can be passed around... string, int, list, function etc.
- Performance scales by some fraction of the length of the sequence.

**Automatic Flattening**: All higher-order Fortuna classes will recursively unpack callable objects returned from the data set at call time. Automatic flattening is dynamic, lazy, fault tolerant and on by default. Un-callable objects or those that require arguments will be returned in an uncalled state without error.

The following examples produce equivalent distributions with comparable performance.
The choice to use one strategy over the other is purely about which one suits you or your data best. Relative weights are easier to understand at a glance. However, many RPG Treasure Tables map rather nicely to a cumulative weighted strategy.

#### Cumulative Weight Strategy
`CumulativeWeightedChoice(weighted_table: Table) -> callable`

_Note: Logic dictates Cumulative Weights must be unique!_

```python
from Fortuna import CumulativeWeightedChoice


cum_weighted_choice = CumulativeWeightedChoice([
    (7, "Apple"),
    (11, "Banana"),
    (13, "Cherry"),
    (23, "Grape"),
    (26, "Lime"),
    (30, "Orange"),  # same as rel weight 4 because 30 - 26 = 4
])

print(cum_weighted_choice())  # prints a weighted random value
```

#### Relative Weight Strategy
`RelativeWeightedChoice(weighted_table: Table) -> callable`

```python
from Fortuna import RelativeWeightedChoice


population = ["Apple", "Banana", "Cherry", "Grape", "Lime", "Orange"]
rel_weights = [7, 4, 2, 10, 3, 4]  # Alternate zip setup.
rel_weighted_choice = RelativeWeightedChoice(zip(rel_weights, population))

print(rel_weighted_choice())  # prints a weighted random value
```

### FlexCat
`FlexCat(dict_of_lists: Matrix) -> callable`

FlexCat is a 2d QuantumMonty.

Rather than taking a sequence, FlexCat takes a Matrix: a dictionary of sequences. When the the instance is called it returns a random value from a random sequence.

The constructor takes two optional keyword arguments to specify the algorithms to be used to make random selections. The algorithm specified for selecting a key need not be the same as the one for selecting values. An optional key may be provided at call time to bypass the random key selection and select a random value from that category. Keys passed in this way must match a key in the Matrix.

By default, FlexCat will use key_bias="front" and val_bias="truffle_shuffle", this will make the top of the data structure geometrically more common than the bottom and it will truffle shuffle the sequence values. This config is known as Top Cat, it produces a descending-step distribution. Many other combinations are available.

**Automatic Flattening**: All higher-order Fortuna classes will recursively unpack callable objects returned from the data set at call time. Automatic flattening is dynamic, lazy, fault tolerant and on by default. Un-callable objects or those that require arguments will be returned in an uncalled state without error.


Algorithm Options: _See QuantumMonty & TruffleShuffle for more details._
- 'front', Geometric Descending
- 'middle', Geometric Median Peak
- 'back', Geometric Ascending
- 'quantum', Geometric Overlay
- 'front_gauss', Exponential Gamma
- 'middle_gauss', Scaled Gaussian
- 'back_gauss', Reversed Gamma
- 'quantum_gauss', Gaussian Overlay
- 'front_poisson', 1/3 Mean Poisson
- 'middle_poisson', 1/2 Mean Poisson
- 'back_poisson', 2/3 Mean Poisson
- 'quantum_poisson', Poisson Overlay
- 'quantum_monty', Quantum Monty Algorithm
- 'uniform', uniform flat distribution
- 'truffle_shuffle', TruffleShuffle, wide uniform distribution


```python
from Fortuna import FlexCat

matrix_data = {
    "Cat_A": ("A1", "A2", "A3", "A4", "A5"),
    "Cat_B": ("B1", "B2", "B3", "B4", "B5"),
    "Cat_C": ("C1", "C2", "C3", "C4", "C5"),
}
flex_cat = FlexCat(matrix_data, key_bias="front", val_bias="back")

flex_cat()          # returns a random "back" value from a random "front" category
flex_cat("Cat_B")   # returns a random "back" value specifically from "Cat_B"
```

## Fortuna Functions
### Random Numbers
- `Fortuna.randbelow(number: int) -> int`
    - Returns a random integer in the exclusive range:
        - [0, number) for positive values.
        - (number, 0] for negative values.
        - Always returns zero when the input is zero
    - Flat uniform distribution.


- `Fortuna.randint(left_limit: int, right_limit: int) -> int`
    - Fault-tolerant, efficient version of random.randint()
    - Returns a random integer in the range [left_limit, right_limit]
    - `randint(1, 10) -> [1, 10]`
    - `randint(10, 1) -> [1, 10]` same as above.
    - Flat uniform distribution.


- `Fortuna.randrange(start: int, stop: int = 0, step: int = 1) -> int`
    - Fault-tolerant, efficient version of random.randrange()
    - Returns a random integer in the range [A, B) by increments of C.
    - `randrange(2, 11, 2) -> [2, 10] by 2` even numbers from 2 to 10.
    - `randrange(10, 1, 0) -> [10]` a step size or range size of zero always returns the first parameter.
    - Flat uniform distribution.


- `Fortuna.d(sides: int) -> int`
    - Represents a single die roll of a given size die.
    - Returns a random integer in the range [1, sides].
    - Flat uniform distribution.


- `Fortuna.dice(rolls: int, sides: int) -> int`
    - Returns a random integer in range [X, Y] where X = rolls and Y = rolls * sides.
    - The return value represents the sum of multiple rolls of the same size die.
    - Geometric distribution based on the number and size of the dice rolled.
    - Complexity scales primarily with the number of rolls, not the size of the dice.


- `Fortuna.plus_or_minus(number: int) -> int`
    - Returns a random integer in range [-number, number].
    - Flat uniform distribution.


- `Fortuna.plus_or_minus_linear(number: int) -> int`
    - Returns a random integer in range [-number, number].
    - Linear geometric, triangle distribution.


### Random Truth
- `Fortuna.percent_true(truth_factor: float = 50.0) -> bool`
    - Always returns False if num is 0.0 or less
    - Always returns True if num is 100.0 or more.
    - Produces True or False based truth_factor: the probability of True as a percentage.


## Fortuna Distribution and Performance Test Suite
```
TruffleShuffle
Output Analysis: TruffleShuffle([4, 9, 5, 0, 1, 10, 6, 7, 2, 8, 3], flat=True)()
Approximate Single Execution Time: Min: 500ns, Mid: 531ns, Max: 1062ns
Raw Samples: 3, 5, 4, 3, 10
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 5
 Maximum: 10
 Mean: 5.01546
 Std Deviation: 3.1563619270619374
Sample Distribution:
 0: 8.838%
 1: 9.014%
 2: 9.22%
 3: 9.12%
 4: 9.152%
 5: 9.126%
 6: 9.02%
 7: 9.183%
 8: 9.078%
 9: 9.021%
 10: 9.228%


QuantumMonty([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
Output Distribution: QuantumMonty.uniform()
Approximate Single Execution Time: Min: 156ns, Mid: 187ns, Max: 750ns
Raw Samples: 4, 5, 10, 8, 10
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 5
 Maximum: 10
 Mean: 5.02063
 Std Deviation: 3.166566701420759
Sample Distribution:
 0: 9.117%
 1: 9.054%
 2: 8.93%
 3: 8.905%
 4: 9.084%
 5: 9.151%
 6: 9.077%
 7: 9.115%
 8: 9.259%
 9: 9.076%
 10: 9.232%

Output Distribution: QuantumMonty.front()
Approximate Single Execution Time: Min: 218ns, Mid: 250ns, Max: 906ns
Raw Samples: 2, 9, 4, 3, 0
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 3
 Maximum: 10
 Mean: 3.33183
 Std Deviation: 2.6864904659071907
Sample Distribution:
 0: 16.791%
 1: 15.027%
 2: 13.548%
 3: 12.117%
 4: 10.706%
 5: 9.199%
 6: 7.515%
 7: 6.047%
 8: 4.495%
 9: 3.039%
 10: 1.516%

Output Distribution: QuantumMonty.back()
Approximate Single Execution Time: Min: 250ns, Mid: 265ns, Max: 656ns
Raw Samples: 5, 6, 8, 4, 8
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 7
 Maximum: 10
 Mean: 6.66221
 Std Deviation: 2.6893494086679066
Sample Distribution:
 0: 1.542%
 1: 3.062%
 2: 4.525%
 3: 6.045%
 4: 7.567%
 5: 9.105%
 6: 10.617%
 7: 12.198%
 8: 13.661%
 9: 14.975%
 10: 16.703%

Output Distribution: QuantumMonty.middle()
Approximate Single Execution Time: Min: 187ns, Mid: 218ns, Max: 343ns
Raw Samples: 3, 4, 6, 2, 6
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 5
 Maximum: 10
 Mean: 5.00763
 Std Deviation: 2.4163919741221056
Sample Distribution:
 0: 2.754%
 1: 5.572%
 2: 8.302%
 3: 11.082%
 4: 13.804%
 5: 16.623%
 6: 13.943%
 7: 11.091%
 8: 8.593%
 9: 5.389%
 10: 2.847%

Output Distribution: QuantumMonty.quantum()
Approximate Single Execution Time: Min: 250ns, Mid: 265ns, Max: 500ns
Raw Samples: 3, 4, 3, 0, 8
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 5
 Maximum: 10
 Mean: 4.98814
 Std Deviation: 2.932464037947156
Sample Distribution:
 0: 7.034%
 1: 7.961%
 2: 8.888%
 3: 9.815%
 4: 10.599%
 5: 11.557%
 6: 10.746%
 7: 9.71%
 8: 9.041%
 9: 7.813%
 10: 6.836%

Output Distribution: QuantumMonty.front_gauss()
Approximate Single Execution Time: Min: 187ns, Mid: 187ns, Max: 593ns
Raw Samples: 1, 0, 1, 2, 2
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 0
 Maximum: 10
 Mean: 0.6748
 Std Deviation: 1.055782225063989
Sample Distribution:
 0: 59.464%
 1: 24.325%
 2: 9.762%
 3: 3.886%
 4: 1.531%
 5: 0.61%
 6: 0.244%
 7: 0.115%
 8: 0.045%
 9: 0.01%
 10: 0.008%

Output Distribution: QuantumMonty.back_gauss()
Approximate Single Execution Time: Min: 187ns, Mid: 187ns, Max: 687ns
Raw Samples: 9, 9, 10, 10, 10
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 10
 Maximum: 10
 Mean: 9.32668
 Std Deviation: 1.0613818553727161
Sample Distribution:
 0: 0.011%
 1: 0.018%
 2: 0.042%
 3: 0.102%
 4: 0.256%
 5: 0.603%
 6: 1.593%
 7: 3.942%
 8: 9.613%
 9: 24.035%
 10: 59.785%

Output Distribution: QuantumMonty.middle_gauss()
Approximate Single Execution Time: Min: 218ns, Mid: 250ns, Max: 781ns
Raw Samples: 5, 6, 4, 7, 6
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 5
 Maximum: 10
 Mean: 4.99966
 Std Deviation: 1.1393300071220152
Sample Distribution:
 0: 0.002%
 1: 0.066%
 2: 1.078%
 3: 7.527%
 4: 23.934%
 5: 34.869%
 6: 23.838%
 7: 7.489%
 8: 1.144%
 9: 0.051%
 10: 0.002%

Output Distribution: QuantumMonty.quantum_gauss()
Approximate Single Execution Time: Min: 218ns, Mid: 250ns, Max: 437ns
Raw Samples: 1, 10, 10, 5, 0
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 5
 Maximum: 10
 Mean: 4.99885
 Std Deviation: 3.692214105648536
Sample Distribution:
 0: 20.003%
 1: 7.938%
 2: 3.47%
 3: 3.901%
 4: 8.641%
 5: 12.065%
 6: 8.582%
 7: 3.919%
 8: 3.635%
 9: 8.05%
 10: 19.796%

Output Distribution: QuantumMonty.front_poisson()
Approximate Single Execution Time: Min: 218ns, Mid: 250ns, Max: 593ns
Raw Samples: 4, 3, 2, 5, 4
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 3
 Maximum: 10
 Mean: 3.50153
 Std Deviation: 1.8584381068580063
Sample Distribution:
 0: 3.056%
 1: 10.42%
 2: 18.468%
 3: 21.533%
 4: 18.919%
 5: 13.387%
 6: 7.704%
 7: 3.937%
 8: 1.643%
 9: 0.67%
 10: 0.263%

Output Distribution: QuantumMonty.back_poisson()
Approximate Single Execution Time: Min: 218ns, Mid: 250ns, Max: 531ns
Raw Samples: 9, 7, 4, 6, 8
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 7
 Maximum: 10
 Mean: 6.50659
 Std Deviation: 1.8556645728175305
Sample Distribution:
 0: 0.242%
 1: 0.646%
 2: 1.671%
 3: 3.946%
 4: 7.649%
 5: 13.246%
 6: 18.865%
 7: 21.649%
 8: 18.566%
 9: 10.454%
 10: 3.066%

Output Distribution: QuantumMonty.middle_poisson()
Approximate Single Execution Time: Min: 250ns, Mid: 250ns, Max: 406ns
Raw Samples: 4, 1, 2, 2, 2
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 5
 Maximum: 10
 Mean: 4.99652
 Std Deviation: 2.3881006929878814
Sample Distribution:
 0: 1.665%
 1: 5.558%
 2: 10.053%
 3: 12.926%
 4: 13.184%
 5: 13.212%
 6: 13.431%
 7: 12.777%
 8: 9.975%
 9: 5.601%
 10: 1.618%

Output Distribution: QuantumMonty.quantum_poisson()
Approximate Single Execution Time: Min: 250ns, Mid: 281ns, Max: 781ns
Raw Samples: 8, 7, 3, 6, 9
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 5
 Maximum: 10
 Mean: 5.00253
 Std Deviation: 2.3875888684834434
Sample Distribution:
 0: 1.596%
 1: 5.705%
 2: 10.005%
 3: 12.575%
 4: 13.446%
 5: 13.223%
 6: 13.329%
 7: 12.835%
 8: 10.074%
 9: 5.617%
 10: 1.595%

Output Distribution: QuantumMonty.quantum_monty()
Approximate Single Execution Time: Min: 250ns, Mid: 281ns, Max: 625ns
Raw Samples: 4, 6, 2, 10, 8
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 5
 Maximum: 10
 Mean: 5.00668
 Std Deviation: 3.050552152690454
Sample Distribution:
 0: 9.403%
 1: 7.19%
 2: 7.544%
 3: 8.756%
 4: 10.854%
 5: 12.261%
 6: 10.979%
 7: 8.822%
 8: 7.442%
 9: 7.253%
 10: 9.496%


Weighted Choice
Base Case
Output Distribution: Random.choices([36, 30, 24, 18], cum_weights=[1, 10, 100, 1000])
Approximate Single Execution Time: Min: 1687ns, Mid: 1718ns, Max: 2218ns
Raw Samples: [18], [18], [18], [18], [18]
Test Samples: 100000
Sample Statistics:
 Minimum: 18
 Median: 18
 Maximum: 36
 Mean: 18.67092
 Std Deviation: 2.1163721657382095
Sample Distribution:
 18: 89.977%
 24: 8.96%
 30: 0.967%
 36: 0.096%

Output Analysis: CumulativeWeightedChoice(<zip object at 0x10b3a6648>, flat=True)()
Approximate Single Execution Time: Min: 281ns, Mid: 312ns, Max: 1062ns
Raw Samples: 18, 18, 18, 18, 18
Test Samples: 100000
Sample Statistics:
 Minimum: 18
 Median: 18
 Maximum: 36
 Mean: 18.6738
 Std Deviation: 2.11647781816478
Sample Distribution:
 18: 89.907%
 24: 9.056%
 30: 0.937%
 36: 0.1%

Base Case
Output Distribution: Random.choices([36, 30, 24, 18], weights=[1, 9, 90, 900])
Approximate Single Execution Time: Min: 2156ns, Mid: 2187ns, Max: 2937ns
Raw Samples: [18], [18], [18], [18], [18]
Test Samples: 100000
Sample Statistics:
 Minimum: 18
 Median: 18
 Maximum: 36
 Mean: 18.67386
 Std Deviation: 2.116883915658845
Sample Distribution:
 18: 89.9%
 24: 9.077%
 30: 0.915%
 36: 0.108%

Output Analysis: RelativeWeightedChoice(<zip object at 0x10b27e288>, flat=True)()
Approximate Single Execution Time: Min: 312ns, Mid: 312ns, Max: 468ns
Raw Samples: 18, 18, 24, 18, 18
Test Samples: 100000
Sample Statistics:
 Minimum: 18
 Median: 18
 Maximum: 36
 Mean: 18.66648
 Std Deviation: 2.0996781886958202
Sample Distribution:
 18: 89.971%
 24: 9.057%
 30: 0.865%
 36: 0.107%


FlexCat
Output Analysis: FlexCat({1: [1, 2, 3], 2: [10, 20, 30], 3: [100, 200, 300]}, key_bias='front', val_bias='truffle_shuffle', flat=True)()
Approximate Single Execution Time: Min: 781ns, Mid: 781ns, Max: 1062ns
Raw Samples: 20, 10, 30, 2, 100
Test Samples: 100000
Sample Statistics:
 Minimum: 1
 Median: 10
 Maximum: 300
 Mean: 41.06798
 Std Deviation: 79.05229200578762
Sample Distribution:
 1: 16.611%
 2: 16.603%
 3: 16.757%
 10: 11.072%
 20: 11.053%
 30: 11.151%
 100: 5.638%
 200: 5.579%
 300: 5.536%


Random Integers
Base Case
Output Distribution: Random.randrange(10)
Approximate Single Execution Time: Min: 843ns, Mid: 906ns, Max: 1312ns
Raw Samples: 4, 9, 2, 8, 3
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 4
 Maximum: 9
 Mean: 4.48934
 Std Deviation: 2.8688061393002227
Sample Distribution:
 0: 10.077%
 1: 9.901%
 2: 10.038%
 3: 10.066%
 4: 10.165%
 5: 10.04%
 6: 9.875%
 7: 9.965%
 8: 9.963%
 9: 9.91%

Output Distribution: randbelow(10)
Approximate Single Execution Time: Min: 62ns, Mid: 62ns, Max: 125ns
Raw Samples: 9, 6, 0, 3, 3
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 4
 Maximum: 9
 Mean: 4.49656
 Std Deviation: 2.8660792575403606
Sample Distribution:
 0: 9.885%
 1: 9.96%
 2: 10.113%
 3: 10.092%
 4: 10.144%
 5: 9.918%
 6: 10.066%
 7: 9.954%
 8: 9.858%
 9: 10.01%

Base Case
Output Distribution: Random.randint(-5, 5)
Approximate Single Execution Time: Min: 1156ns, Mid: 1218ns, Max: 1937ns
Raw Samples: -5, 4, -4, 2, 2
Test Samples: 100000
Sample Statistics:
 Minimum: -5
 Median: 0
 Maximum: 5
 Mean: 0.01192
 Std Deviation: 3.1625556012787053
Sample Distribution:
 -5: 8.992%
 -4: 9.094%
 -3: 9.088%
 -2: 9.109%
 -1: 9.019%
 0: 9.065%
 1: 9.115%
 2: 9.075%
 3: 9.099%
 4: 9.253%
 5: 9.091%

Output Distribution: randint(-5, 5)
Approximate Single Execution Time: Min: 62ns, Mid: 62ns, Max: 187ns
Raw Samples: 5, 4, -3, -5, 3
Test Samples: 100000
Sample Statistics:
 Minimum: -5
 Median: 0
 Maximum: 5
 Mean: 0.01942
 Std Deviation: 3.1624109271296037
Sample Distribution:
 -5: 8.987%
 -4: 9.038%
 -3: 9.013%
 -2: 9.062%
 -1: 9.083%
 0: 9.142%
 1: 9.175%
 2: 9.006%
 3: 9.135%
 4: 9.112%
 5: 9.247%

Base Case
Output Distribution: Random.randrange(1, 21, 2)
Approximate Single Execution Time: Min: 1312ns, Mid: 1375ns, Max: 1718ns
Raw Samples: 17, 15, 3, 11, 5
Test Samples: 100000
Sample Statistics:
 Minimum: 1
 Median: 11
 Maximum: 19
 Mean: 10.01174
 Std Deviation: 5.742357696897607
Sample Distribution:
 1: 9.969%
 3: 9.979%
 5: 9.872%
 7: 10.01%
 9: 10.084%
 11: 10.156%
 13: 9.971%
 15: 9.886%
 17: 9.967%
 19: 10.106%

Output Distribution: randrange(1, 21, 2)
Approximate Single Execution Time: Min: 62ns, Mid: 93ns, Max: 343ns
Raw Samples: 9, 5, 11, 11, 1
Test Samples: 100000
Sample Statistics:
 Minimum: 1
 Median: 11
 Maximum: 19
 Mean: 10.0128
 Std Deviation: 5.744277685424102
Sample Distribution:
 1: 9.911%
 3: 9.941%
 5: 10.214%
 7: 9.96%
 9: 9.804%
 11: 10.024%
 13: 10.099%
 15: 9.878%
 17: 10.206%
 19: 9.963%

Output Distribution: d(10)
Approximate Single Execution Time: Min: 31ns, Mid: 62ns, Max: 93ns
Raw Samples: 4, 9, 2, 2, 5
Test Samples: 100000
Sample Statistics:
 Minimum: 1
 Median: 5
 Maximum: 10
 Mean: 5.5033
 Std Deviation: 2.8747263783736887
Sample Distribution:
 1: 9.999%
 2: 9.974%
 3: 9.958%
 4: 10.097%
 5: 10.053%
 6: 9.819%
 7: 10.072%
 8: 9.91%
 9: 10.022%
 10: 10.096%

Output Distribution: dice(2, 6)
Approximate Single Execution Time: Min: 62ns, Mid: 93ns, Max: 156ns
Raw Samples: 6, 9, 8, 8, 9
Test Samples: 100000
Sample Statistics:
 Minimum: 2
 Median: 7
 Maximum: 12
 Mean: 6.99928
 Std Deviation: 2.4163935671116805
Sample Distribution:
 2: 2.797%
 3: 5.539%
 4: 8.36%
 5: 11.116%
 6: 13.834%
 7: 16.724%
 8: 13.904%
 9: 10.954%
 10: 8.448%
 11: 5.561%
 12: 2.763%

Output Distribution: plus_or_minus(5)
Approximate Single Execution Time: Min: 62ns, Mid: 62ns, Max: 125ns
Raw Samples: -4, -1, -5, 2, 2
Test Samples: 100000
Sample Statistics:
 Minimum: -5
 Median: 0
 Maximum: 5
 Mean: -0.00064
 Std Deviation: 3.1677626075196
Sample Distribution:
 -5: 9.087%
 -4: 9.082%
 -3: 9.207%
 -2: 9.084%
 -1: 9.21%
 0: 8.981%
 1: 8.892%
 2: 9.025%
 3: 9.205%
 4: 8.994%
 5: 9.233%

Output Distribution: binomial(4, 0.5)
Approximate Single Execution Time: Min: 156ns, Mid: 171ns, Max: 1156ns
Raw Samples: 2, 1, 3, 3, 3
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 2
 Maximum: 4
 Mean: 2.00141
 Std Deviation: 0.9984578013515698
Sample Distribution:
 0: 6.228%
 1: 24.861%
 2: 37.683%
 3: 24.998%
 4: 6.23%

Output Distribution: negative_binomial(5, 0.75)
Approximate Single Execution Time: Min: 125ns, Mid: 156ns, Max: 968ns
Raw Samples: 2, 4, 2, 1, 3
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 1
 Maximum: 13
 Mean: 1.67778
 Std Deviation: 1.4918768476537483
Sample Distribution:
 0: 23.45%
 1: 29.539%
 2: 22.368%
 3: 13.159%
 4: 6.542%
 5: 2.968%
 6: 1.245%
 7: 0.452%
 8: 0.171%
 9: 0.07%
 10: 0.019%
 11: 0.009%
 12: 0.007%
 13: 0.001%

Output Distribution: geometric(0.75)
Approximate Single Execution Time: Min: 31ns, Mid: 62ns, Max: 750ns
Raw Samples: 0, 0, 0, 0, 0
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 0
 Maximum: 8
 Mean: 0.33174
 Std Deviation: 0.6698156902690391
Sample Distribution:
 0: 75.185%
 1: 18.638%
 2: 4.594%
 3: 1.14%
 4: 0.33%
 5: 0.078%
 6: 0.028%
 7: 0.006%
 8: 0.001%

Output Distribution: poisson(4.5)
Approximate Single Execution Time: Min: 93ns, Mid: 125ns, Max: 187ns
Raw Samples: 4, 4, 3, 4, 3
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 4
 Maximum: 16
 Mean: 4.49389
 Std Deviation: 2.1209732796941436
Sample Distribution:
 0: 1.145%
 1: 5.11%
 2: 11.101%
 3: 16.899%
 4: 18.954%
 5: 17.296%
 6: 12.781%
 7: 8.051%
 8: 4.632%
 9: 2.34%
 10: 1.048%
 11: 0.387%
 12: 0.175%
 13: 0.054%
 14: 0.021%
 15: 0.004%
 16: 0.002%

Output Distribution: discrete(7, 1, 30, 1)
Approximate Single Execution Time: Min: 406ns, Mid: 421ns, Max: 593ns
Raw Samples: 1, 6, 6, 4, 0
Test Samples: 100000
Sample Statistics:
 Minimum: 0
 Median: 4
 Maximum: 6
 Mean: 3.9985
 Std Deviation: 1.7336688859404672
Sample Distribution:
 0: 3.573%
 1: 7.217%
 2: 10.685%
 3: 14.245%
 4: 17.894%
 5: 21.364%
 6: 25.022%


Random Floats
Output Distribution: random()
Approximate Single Execution Time: Min: 31ns, Mid: 31ns, Max: 312ns
Raw Samples: 0.3565370823682788, 0.13734980097834648, 0.7885734510668825, 0.14794052154345932, 0.5048187362996128
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 7.971441592182318e-06
 Median: (0.4978174485076451, 0.49782963854350065)
 Maximum: 0.9999648608443529
 Mean: 0.4991029501627448
 Std Deviation: 0.2887765249052703
Post-processor Distribution using round method:
 0: 50.213%
 1: 49.787%

Output Distribution: uniform(0.0, 10.0)
Approximate Single Execution Time: Min: 31ns, Mid: 62ns, Max: 93ns
Raw Samples: 6.884533140588345, 6.53158870051705, 9.312531984738406, 4.720537649078803, 4.16106928781009
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 0.000298398570238695
 Median: (5.031294337979847, 5.03132187363235)
 Maximum: 9.99994400003516
 Mean: 5.009432064409703
 Std Deviation: 2.8876860173275802
Post-processor Distribution using floor method:
 0: 10.057%
 1: 9.964%
 2: 9.901%
 3: 9.83%
 4: 9.921%
 5: 10.123%
 6: 10.275%
 7: 9.881%
 8: 9.963%
 9: 10.085%

Output Distribution: expovariate(1.0)
Approximate Single Execution Time: Min: 62ns, Mid: 62ns, Max: 125ns
Raw Samples: 0.2311154191409478, 3.968092823933531, 0.035313633478626344, 0.32855551997774607, 1.884230775905545
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 5.1111564329046254e-05
 Median: (0.6869954052819331, 0.686999867893883)
 Maximum: 12.606532702352837
 Mean: 0.9949086851112836
 Std Deviation: 0.9997027251699514
Post-processor Distribution using floor method:
 0: 63.479%
 1: 23.066%
 2: 8.481%
 3: 3.171%
 4: 1.146%
 5: 0.405%
 6: 0.166%
 7: 0.049%
 8: 0.025%
 9: 0.007%
 10: 0.003%
 11: 0.001%
 12: 0.001%

Output Distribution: gammavariate(2.0, 1.0)
Approximate Single Execution Time: Min: 93ns, Mid: 125ns, Max: 187ns
Raw Samples: 1.9542100695146, 3.748737937739269, 10.094475297793208, 1.5439306724249025, 0.11356470320433132
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 0.0011704658422648784
 Median: (1.6779764637313979, 1.677979666446221)
 Maximum: 14.767819047486542
 Mean: 2.0016330974400214
 Std Deviation: 1.417665982750131
Post-processor Distribution using round method:
 0: 9.009%
 1: 35.255%
 2: 26.956%
 3: 15.117%
 4: 7.522%
 5: 3.475%
 6: 1.529%
 7: 0.653%
 8: 0.284%
 9: 0.122%
 10: 0.04%
 11: 0.021%
 12: 0.011%
 13: 0.003%
 15: 0.003%

Output Distribution: weibullvariate(1.0, 1.0)
Approximate Single Execution Time: Min: 93ns, Mid: 93ns, Max: 437ns
Raw Samples: 0.9535118835219747, 0.23348731079651563, 0.06312524274188812, 3.256790769227524, 0.683913062972639
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 3.0503962355549358e-05
 Median: (0.6911555072382514, 0.6911855920675133)
 Maximum: 12.360963157003269
 Mean: 0.9981887048802922
 Std Deviation: 0.9997158425625051
Post-processor Distribution using floor method:
 0: 63.2%
 1: 23.372%
 2: 8.425%
 3: 3.19%
 4: 1.119%
 5: 0.431%
 6: 0.169%
 7: 0.062%
 8: 0.024%
 9: 0.006%
 11: 0.001%
 12: 0.001%

Output Distribution: betavariate(3.0, 3.0)
Approximate Single Execution Time: Min: 156ns, Mid: 187ns, Max: 312ns
Raw Samples: 0.7030425568271423, 0.5427844035691809, 0.7998410706681864, 0.7742059916831422, 0.6437639949836683
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 0.004998034171167228
 Median: (0.498922206054175, 0.4989319633782197)
 Maximum: 0.9917570531201851
 Mean: 0.4989020405217913
 Std Deviation: 0.18817071762289955
Post-processor Distribution using round method:
 0: 50.219%
 1: 49.781%

Output Distribution: paretovariate(4.0)
Approximate Single Execution Time: Min: 62ns, Mid: 93ns, Max: 187ns
Raw Samples: 1.7786385982246173, 1.9446451827887488, 1.1701904389138686, 1.566108728663758, 1.5129632495569594
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 1.0000029580153795
 Median: (1.1888485905358435, 1.1888596281660133)
 Maximum: 23.181965208212766
 Mean: 1.3326269364139982
 Std Deviation: 0.47150669764863595
Post-processor Distribution using floor method:
 1: 93.846%
 2: 4.913%
 3: 0.848%
 4: 0.227%
 5: 0.081%
 6: 0.039%
 7: 0.017%
 8: 0.012%
 9: 0.012%
 12: 0.001%
 13: 0.001%
 14: 0.002%
 23: 0.001%

Output Distribution: gauss(1.0, 1.0)
Approximate Single Execution Time: Min: 62ns, Mid: 93ns, Max: 187ns
Raw Samples: 2.3559217300503756, 1.135383457954648, 1.7579528094413734, 0.8804676988710793, 0.4590517603200212
Test Samples: 100000
Pre-processor Statistics:
 Minimum: -3.238771925497142
 Median: (1.0055805570018521, 1.0055842001429098)
 Maximum: 5.492877189189674
 Mean: 1.0033977955236313
 Std Deviation: 1.0009240737437017
Post-processor Distribution using round method:
 -3: 0.023%
 -2: 0.589%
 -1: 6.146%
 0: 24.066%
 1: 37.884%
 2: 24.652%
 3: 6.034%
 4: 0.587%
 5: 0.019%

Output Distribution: normalvariate(0.0, 2.8)
Approximate Single Execution Time: Min: 62ns, Mid: 93ns, Max: 375ns
Raw Samples: -1.6310243480949491, 2.1475503715629656, 1.7199424795797946, 1.7892427106675242, 2.721071026052622
Test Samples: 100000
Pre-processor Statistics:
 Minimum: -10.955981604613521
 Median: (0.0040100141946724, 0.004170039813196934)
 Maximum: 12.90412239296377
 Mean: 0.007910406647645515
 Std Deviation: 2.81445640105863
Post-processor Distribution using round method:
 -11: 0.003%
 -10: 0.033%
 -9: 0.087%
 -8: 0.278%
 -7: 0.615%
 -6: 1.541%
 -5: 2.86%
 -4: 5.17%
 -3: 8.063%
 -2: 11.081%
 -1: 13.106%
 0: 14.108%
 1: 13.204%
 2: 11.099%
 3: 8.094%
 4: 5.054%
 5: 3.033%
 6: 1.492%
 7: 0.687%
 8: 0.268%
 9: 0.091%
 10: 0.025%
 11: 0.006%
 12: 0.001%
 13: 0.001%

Output Distribution: lognormvariate(0.0, 0.5)
Approximate Single Execution Time: Min: 93ns, Mid: 125ns, Max: 187ns
Raw Samples: 1.2967728216793235, 0.7713983903721738, 0.9459713063388208, 0.5980998271647062, 0.769932913153785
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 0.11341381764309312
 Median: (1.0015181988095054, 1.0015205802437293)
 Maximum: 10.201242346210485
 Mean: 1.1341332692766037
 Std Deviation: 0.6044861205614751
Post-processor Distribution using round method:
 0: 8.247%
 1: 70.817%
 2: 17.568%
 3: 2.751%
 4: 0.473%
 5: 0.115%
 6: 0.02%
 7: 0.005%
 8: 0.003%
 10: 0.001%

Output Distribution: vonmisesvariate(0, 0)
Approximate Single Execution Time: Min: 62ns, Mid: 62ns, Max: 156ns
Raw Samples: 2.590938548812516, 5.277005852512543, 4.051814000354434, 5.2740752782813, 1.5769380222935188
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 4.886465671697944e-05
 Median: (3.1488883930246705, 3.1489518583903635)
 Maximum: 6.283181808721914
 Mean: 3.1466951912038037
 Std Deviation: 1.8155026354958856
Post-processor Distribution using floor method:
 0: 15.887%
 1: 15.86%
 2: 15.919%
 3: 15.785%
 4: 15.921%
 5: 16.186%
 6: 4.442%

Output Distribution: triangular(0.0, 10.0, 0.0)
Approximate Single Execution Time: Min: 31ns, Mid: 62ns, Max: 125ns
Raw Samples: 2.2508067306023216, 1.3696571161484061, 3.911468604482291, 1.9656680921746417, 0.27189181535119844
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 8.560807561841521e-05
 Median: (2.9088457942262647, 2.9088774653378935)
 Maximum: 9.996780376629896
 Mean: 3.319936423685773
 Std Deviation: 2.3480252131988855
Post-processor Distribution using floor method:
 0: 18.973%
 1: 17.184%
 2: 15.178%
 3: 12.935%
 4: 10.926%
 5: 8.991%
 6: 6.979%
 7: 4.939%
 8: 2.938%
 9: 0.957%

Output Distribution: extreme_value(0.0, 1.0)
Approximate Single Execution Time: Min: 62ns, Mid: 93ns, Max: 156ns
Raw Samples: -1.2477192230795378, -0.9893678531592978, -0.12738261674471202, 0.03398774747656757, 0.5856936535081156
Test Samples: 100000
Pre-processor Statistics:
 Minimum: -2.465237303293696
 Median: (0.3604686899576995, 0.36047974703774677)
 Maximum: 11.683629502181127
 Mean: 0.5683003942213007
 Std Deviation: 1.2756703158128062
Post-processor Distribution using round method:
 -2: 1.167%
 -1: 18.198%
 0: 35.424%
 1: 25.341%
 2: 12.154%
 3: 4.864%
 4: 1.82%
 5: 0.635%
 6: 0.261%
 7: 0.092%
 8: 0.024%
 9: 0.011%
 10: 0.004%
 11: 0.004%
 12: 0.001%

Output Distribution: chi_squared(1.0)
Approximate Single Execution Time: Min: 93ns, Mid: 125ns, Max: 468ns
Raw Samples: 1.204183852204437, 3.2510066515992895, 0.7699574772301343, 0.033659450231865215, 0.9295544044253864
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 8.815885261230735e-11
 Median: (0.45619678555616133, 0.45622448727581977)
 Maximum: 20.793075950478197
 Mean: 1.0005306335725963
 Std Deviation: 1.4110615169559995
Post-processor Distribution using <lambda> method:
 0: 68.393%
 1: 15.93%
 2: 7.389%
 3: 3.879%
 4: 2.049%
 5: 1.117%
 6: 0.606%
 7: 0.334%
 8: 0.197%
 9: 0.106%

Output Distribution: cauchy(0.0, 1.0)
Approximate Single Execution Time: Min: 62ns, Mid: 93ns, Max: 125ns
Raw Samples: 1.4481900215560417, -0.2903894536013803, 1.3588839976812574, -3.8804167653884623, 1.9630666671731054
Test Samples: 100000
Pre-processor Statistics:
 Minimum: -51695.76069456358
 Median: (0.0019493793066672756, 0.002022388251476377)
 Maximum: 32739.22809275739
 Mean: -1.0256281500154385
 Std Deviation: 253.18564743999121
Post-processor Distribution using <lambda> method:
 0: 26.177%
 1: 11.259%
 2: 5.815%
 3: 3.786%
 4: 3.072%
 5: 3.062%
 6: 3.756%
 7: 5.682%
 8: 11.258%
 9: 26.133%

Output Distribution: fisher_f(8.0, 8.0)
Approximate Single Execution Time: Min: 156ns, Mid: 187ns, Max: 281ns
Raw Samples: 0.42960147652253244, 1.4674083534837787, 1.0530795840715712, 0.3674568622745032, 0.6043782427403955
Test Samples: 100000
Pre-processor Statistics:
 Minimum: 0.023075617269833905
 Median: (0.993445867081011, 0.9934838022071381)
 Maximum: 49.38149443055933
 Mean: 1.3256063687898703
 Std Deviation: 1.220058524726432
Post-processor Distribution using <lambda> method:
 0: 50.381%
 1: 32.524%
 2: 10.204%
 3: 3.729%
 4: 1.625%
 5: 0.748%
 6: 0.354%
 7: 0.228%
 8: 0.121%
 9: 0.086%

Output Distribution: student_t(8.0)
Approximate Single Execution Time: Min: 125ns, Mid: 156ns, Max: 750ns
Raw Samples: -1.2431907737693988, 1.6133333494368292, -0.7663246072871094, 0.9790277292417401, 0.2064162858708046
Test Samples: 100000
Pre-processor Statistics:
 Minimum: -9.169734490494319
 Median: (-0.0029464279891523427, -0.002923719899289867)
 Maximum: 8.09085204849599
 Mean: -0.0009705956479040052
 Std Deviation: 1.151728696211737
Post-processor Distribution using round method:
 -9: 0.002%
 -8: 0.004%
 -7: 0.006%
 -6: 0.022%
 -5: 0.064%
 -4: 0.342%
 -3: 1.447%
 -2: 6.613%
 -1: 23.034%
 0: 36.963%
 1: 22.961%
 2: 6.725%
 3: 1.434%
 4: 0.31%
 5: 0.055%
 6: 0.011%
 7: 0.005%
 8: 0.002%


Random Booleans
Output Distribution: percent_true(33.33)
Approximate Single Execution Time: Min: 31ns, Mid: 62ns, Max: 125ns
Raw Samples: False, True, False, False, False
Test Samples: 100000
Sample Statistics:
 Minimum: False
 Median: False
 Maximum: True
 Mean: 0.3315
 Std Deviation: 0.4707546771936111
Sample Distribution:
 False: 66.85%
 True: 33.15%


Random Shuffles
Timer only: shuffle(some_list) of size 10:
Approximate Single Execution Time: Min: 437ns, Mid: 468ns, Max: 2343ns

Timer only: knuth(some_list) of size 10:
Approximate Single Execution Time: Min: 1031ns, Mid: 1062ns, Max: 2125ns

Timer only: fisher_yates(some_list) of size 10:
Approximate Single Execution Time: Min: 1156ns, Mid: 1390ns, Max: 4593ns


Random Values
Base Case
Output Distribution: Random.choice([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
Approximate Single Execution Time: Min: 937ns, Mid: 1390ns, Max: 3750ns
Raw Samples: 5, 3, 5, 4, 9
Test Samples: 100000
Sample Statistics:
 Minimum: 1
 Median: 6
 Maximum: 10
 Mean: 5.50904
 Std Deviation: 2.8734092717899467
Sample Distribution:
 1: 10.036%
 2: 9.837%
 3: 10.051%
 4: 9.935%
 5: 9.917%
 6: 10.163%
 7: 9.863%
 8: 10.143%
 9: 9.997%
 10: 10.058%

Output Distribution: random_value([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
Approximate Single Execution Time: Min: 62ns, Mid: 62ns, Max: 156ns
Raw Samples: 2, 1, 3, 8, 1
Test Samples: 100000
Sample Statistics:
 Minimum: 1
 Median: 5
 Maximum: 10
 Mean: 5.49293
 Std Deviation: 2.8721477168532044
Sample Distribution:
 1: 10.038%
 2: 10.075%
 3: 9.902%
 4: 10.01%
 5: 10.177%
 6: 9.924%
 7: 9.952%
 8: 10.058%
 9: 9.838%
 10: 10.026%

```


## Fortuna Development Log
##### Fortuna 2.1.0, Major Update
- Fortuna now includes the best of the RNG API and the Pyewacket API.

##### Fortuna 2.0.3
- Bug fix.

##### Fortuna 2.0.2
- Clarified some documentation.

##### Fortuna 2.0.1
- Fixed some typos.

##### Fortuna 2.0.0b1-10
- Total rebuild. New RNG Storm Engine.

##### Fortuna 1.26.7.1
- README updated.

##### Fortuna 1.26.7
- Small bug fix.

##### Fortuna 1.26.6
- Updated README to reflect recent changes to the test script.

##### Fortuna 1.26.5
- Fixed small bug in test script.

##### Fortuna 1.26.4
- Updated documentation for clarity.
- Fixed a minor typo in the test script.

##### Fortuna 1.26.3
- Clean build.

##### Fortuna 1.26.2
- Fixed some minor typos.

##### Fortuna 1.26.1
- Release.

##### Fortuna 1.26.0 beta 2
- Moved README and LICENSE files into fortuna_extras folder.

##### Fortuna 1.26.0 beta 1
- Dynamic version scheme implemented.
- The Fortuna Extension now requires the fortuna_extras package, previously it was optional.

##### Fortuna 1.25.4
- Fixed some minor typos in the test script.

##### Fortuna 1.25.3
- Since version 1.24 Fortuna requires Python 3.7 or higher. This patch corrects an issue where the setup script incorrectly reported requiring Python 3.6 or higher.

##### Fortuna 1.25.2
- Updated test suite.
- Major performance update for TruffleShuffle.
- Minor performance update for QuantumMonty & FlexCat: cycle monty.

##### Fortuna 1.25.1
- Important bug fix for TruffleShuffle, QuantumMonty and FlexCat.

##### Fortuna 1.25
- Full 64bit support.
- The Distribution & Performance Tests have been redesigned.
- Bloat Control: Two experimental features have been removed.
    - RandomWalk
    - CatWalk
- Bloat Control: Several utility functions have been removed from the top level API. These function remain in the Fortuna namespace for now, but may change in the future without warning.
    - stretch_bell, internal only.
    - min_max, not used anymore.
    - analytic_continuation, internal only.
    - flatten, internal only.

##### Fortuna 1.24.3
- Low level refactoring, non-breaking patch.

##### Fortuna 1.24.2
- Setup config updated to improve installation.

##### Fortuna 1.24.1
- Low level patch to avoid potential ADL issue. All low level function calls are now qualified.

##### Fortuna 1.24
- Documentation updated for even more clarity.
- Bloat Control: Two naïve utility functions that are no longer used in the module have been removed.
    - n_samples -> use a list comprehension instead. `[f(x) for _ in range(n)]`
    - bind -> use a lambda instead. `lambda: f(x)`

##### Fortuna 1.23.7
- Documentation updated for clarity.
- Minor bug fixes.
- TruffleShuffle has been redesigned slightly, it now uses a random rotate instead of swap.
- Custom `__repr__` methods have been added to each class.

##### Fortuna 1.23.6
- New method for QuantumMonty: quantum_not_monty - produces the upside down quantum_monty.
- New bias option for FlexCat: not_monty.

##### Fortuna 1.23.5.1
- Fixed some small typos.

##### Fortuna 1.23.5
- Documentation updated for clarity.
- All sequence wrappers can now accept generators as input.
- Six new functions added:
    - random_float() -> float in range [0.0..1.0) exclusive, uniform flat distribution.
    - percent_true_float(num: float) -> bool, Like percent_true but with floating point precision.
    - plus_or_minus_linear_down(num: int) -> int in range [-num..num], upside down pyramid.
    - plus_or_minus_curve_down(num: int) -> int in range [-num..num], upside down bell curve.
    - mostly_not_middle(num: int) -> int in range [0..num], upside down pyramid.
    - mostly_not_center(num: int) -> int in range [0..num], upside down bell curve.
- Two new methods for QuantumMonty:
    - mostly_not_middle
    - mostly_not_center
- Two new bias options for FlexCat, either can be used to define x and/or y axis bias:
    - not_middle
    - not_center

##### Fortuna 1.23.4.2
- Fixed some minor typos in the README.md file.

##### Fortuna 1.23.4.1
- Fixed some minor typos in the test suite.

##### Fortuna 1.23.4
- Fortuna is now Production/Stable!
- Fortuna and Fortuna Pure now use the same test suite.

##### Fortuna 0.23.4, first release candidate.
- RandomCycle, BlockCycle and TruffleShuffle have been refactored and combined into one class: TruffleShuffle.
- QuantumMonty and FlexCat will now use the new TruffleShuffle for cycling.
- Minor refactoring across the module.

##### Fortuna 0.23.3, internal
- Function shuffle(arr: list) added.

##### Fortuna 0.23.2, internal
- Simplified the plus_or_minus_curve(num: int) function, output will now always be bounded to the range [-num..num].
- Function stretched_bell(num: int) added, this matches the previous behavior of an unbounded plus_or_minus_curve.

##### Fortuna 0.23.1, internal
- Small bug fixes and general clean up.

##### Fortuna 0.23.0
- The number of test cycles in the test suite has been reduced to 10,000 (down from 100,000). The performance of the pure python implementation and the c-extension are now directly comparable.
- Minor tweaks made to the examples in `.../fortuna_extras/fortuna_examples.py`

##### Fortuna 0.22.2, experimental features
- BlockCycle class added.
- RandomWalk class added.
- CatWalk class added.

##### Fortuna 0.22.1
- Fortuna classes no longer return lists of values, this behavior has been extracted to a free function called n_samples.

##### Fortuna 0.22.0, experimental features
- Function bind added.
- Function n_samples added.

##### Fortuna 0.21.3
- Flatten will no longer raise an error if passed a callable item that it can't call. It correctly returns such items in an uncalled state without error.
- Simplified `.../fortuna_extras/fortuna_examples.py` - removed unnecessary class structure.

##### Fortuna 0.21.2
- Fix some minor bugs.

##### Fortuna 0.21.1
- Fixed a bug in `.../fortuna_extras/fortuna_examples.py`

##### Fortuna 0.21.0
- Function flatten added.
- Flatten: The Fortuna classes will recursively unpack callable objects in the data set.

##### Fortuna 0.20.10
- Documentation updated.

##### Fortuna 0.20.9
- Minor bug fixes.

##### Fortuna 0.20.8, internal
- Testing cycle for potential new features.

##### Fortuna 0.20.7
- Documentation updated for clarity.

##### Fortuna 0.20.6
- Tests updated based on recent changes.

##### Fortuna 0.20.5, internal
- Documentation updated based on recent changes.

##### Fortuna 0.20.4, internal
- WeightedChoice (both types) can optionally return a list of samples rather than just one value, control the length of the list via the n_samples argument.

##### Fortuna 0.20.3, internal
- RandomCycle can optionally return a list of samples rather than just one value,
control the length of the list via the n_samples argument.

##### Fortuna 0.20.2, internal
- QuantumMonty can optionally return a list of samples rather than just one value,
control the length of the list via the n_samples argument.

##### Fortuna 0.20.1, internal
- FlexCat can optionally return a list of samples rather than just one value,
control the length of the list via the n_samples argument.

##### Fortuna 0.20.0, internal
- FlexCat now accepts a standard dict as input. The ordered(ness) of dict is now part of the standard in Python 3.7.1. Previously FlexCat required an OrderedDict, now it accepts either and treats them the same.

##### Fortuna 0.19.7
- Fixed bug in `.../fortuna_extras/fortuna_examples.py`.

##### Fortuna 0.19.6
- Updated documentation formatting.
- Small performance tweak for QuantumMonty and FlexCat.

##### Fortuna 0.19.5
- Minor documentation update.

##### Fortuna 0.19.4
- Minor update to all classes for better debugging.

##### Fortuna 0.19.3
- Updated plus_or_minus_curve to allow unbounded output.

##### Fortuna 0.19.2
- Internal development cycle.
- Minor update to FlexCat for better debugging.

##### Fortuna 0.19.1
- Internal development cycle.

##### Fortuna 0.19.0
- Updated documentation for clarity.
- MultiCat has been removed, it is replaced by FlexCat.
- Mostly has been removed, it is replaced by QuantumMonty.

##### Fortuna 0.18.7
- Fixed some more README typos.

##### Fortuna 0.18.6
- Fixed some README typos.

##### Fortuna 0.18.5
- Updated documentation.
- Fixed another minor test bug.

##### Fortuna 0.18.4
- Updated documentation to reflect recent changes.
- Fixed some small test bugs.
- Reduced default number of test cycles to 10,000 - down from 100,000.

##### Fortuna 0.18.3
- Fixed some minor README typos.

##### Fortuna 0.18.2
- Fixed a bug with Fortuna Pure.

##### Fortuna 0.18.1
- Fixed some minor typos.
- Added tests for `.../fortuna_extras/fortuna_pure.py`

##### Fortuna 0.18.0
- Introduced new test format, now includes average call time in nanoseconds.
- Reduced default number of test cycles to 100,000 - down from 1,000,000.
- Added pure Python implementation of Fortuna: `.../fortuna_extras/fortuna_pure.py`
- Promoted several low level functions to top level.
    - `zero_flat(num: int) -> int`
    - `zero_cool(num: int) -> int`
    - `zero_extreme(num: int) -> int`
    - `max_cool(num: int) -> int`
    - `max_extreme(num: int) -> int`
    - `analytic_continuation(func: staticmethod, num: int) -> int`
    - `min_max(num: int, lo: int, hi: int) -> int`

##### Fortuna 0.17.3
- Internal development cycle.

##### Fortuna 0.17.2
- User Requested: dice() and d() functions now support negative numbers as input.

##### Fortuna 0.17.1
- Fixed some minor typos.

##### Fortuna 0.17.0
- Added QuantumMonty to replace Mostly, same default behavior with more options.
- Mostly is depreciated and may be removed in a future release.
- Added FlexCat to replace MultiCat, same default behavior with more options.
- MultiCat is depreciated and may be removed in a future release.
- Expanded the Treasure Table example in `.../fortuna_extras/fortuna_examples.py`

##### Fortuna 0.16.2
- Minor refactoring for WeightedChoice.

##### Fortuna 0.16.1
- Redesigned fortuna_examples.py to feature a dynamic random magic item generator.
- Raised cumulative_weighted_choice function to top level.
- Added test for cumulative_weighted_choice as free function.
- Updated MultiCat documentation for clarity.

##### Fortuna 0.16.0
- Pushed distribution_timer to the .pyx layer.
- Changed default number of iterations of tests to 1 million, up form 1 hundred thousand.
- Reordered tests to better match documentation.
- Added Base Case Fortuna.fast_rand_below.
- Added Base Case Fortuna.fast_d.
- Added Base Case Fortuna.fast_dice.

##### Fortuna 0.15.10
- Internal Development Cycle

##### Fortuna 0.15.9
- Added Base Cases for random.choices()
- Added Base Case for randint_dice()

##### Fortuna 0.15.8
- Clarified MultiCat Test

##### Fortuna 0.15.7
- Fixed minor typos.

##### Fortuna 0.15.6
- Fixed minor typos.
- Simplified MultiCat example.

##### Fortuna 0.15.5
- Added MultiCat test.
- Fixed some minor typos in docs.

##### Fortuna 0.15.4
- Performance optimization for both WeightedChoice() variants.
- Cython update provides small performance enhancement across the board.
- Compilation now leverages Python3 all the way down.
- MultiCat pushed to the .pyx layer for better performance.

##### Fortuna 0.15.3
- Reworked the MultiCat example to include several randomizing strategies working in concert.
- Added Multi Dice 10d10 performance tests.
- Updated sudo code in documentation to be more pythonic.

##### Fortuna 0.15.2
- Fixed: Linux installation failure.
- Added: complete source files to the distribution (.cpp .hpp .pyx).

##### Fortuna 0.15.1
- Updated & simplified distribution_timer in `fortuna_tests.py`
- Readme updated, fixed some typos.
- Known issue preventing successful installation on some linux platforms.

##### Fortuna 0.15.0
- Performance tweaks.
- Readme updated, added some details.

##### Fortuna 0.14.1
- Readme updated, fixed some typos.

##### Fortuna 0.14.0
- Fixed a bug where the analytic continuation algorithm caused a rare issue during compilation on some platforms.

##### Fortuna 0.13.3
- Fixed Test Bug: percent sign was missing in output distributions.
- Readme updated: added update history, fixed some typos.

##### Fortuna 0.13.2
- Readme updated for even more clarity.

##### Fortuna 0.13.1
- Readme updated for clarity.

##### Fortuna 0.13.0
- Minor Bug Fixes.
- Readme updated for aesthetics.
- Added Tests: `.../fortuna_extras/fortuna_tests.py`

##### Fortuna 0.12.0
- Internal test for future update.

##### Fortuna 0.11.0
- Initial Release: Public Beta

##### Fortuna 0.10.0
- Module name changed from Dice to Fortuna

##### Dice 0.1.x - 0.9.x
- Experimental Phase


## Legal Information
Fortuna © 2019 Broken aka Robert W Sharp, all rights reserved.

Fortuna is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.

See online version of this license here: <http://creativecommons.org/licenses/by-nc/3.0/>
