get_random_outcome()
dict
required
A dictionary of
{outcome: weight} pairs. Weights can be any positive numeric values — they do not need to sum to 1.float
default:"None"
Pre-computed sum of all weights. Pass this to avoid recomputing it on every call in tight loops. If
None, the sum is computed internally.Usage examples
get_random_outcome() uses random.uniform internally. For reproducible results in testing, seed Python’s random module before calling it: random.seed(42).Statistical helpers
get_mean_std_median(dist)
dict
required
A
{win_value: count} dictionary representing a win distribution (e.g. from a lookup table).(mean, std_dev, median) as a tuple of floats.
normalize(distribution)
1.0. Modifies the dictionary directly.
PAR sheet generation — run_analysis.py
The run() function in run_analysis.py generates a .xlsx PAR sheet from an optimized lookup table.
dict
required
An optimized lookup table as generated by the optimization algorithm. Expected format matches the segmented lookup table structure.
dict
required
Contents of
force_record_<mode>.json. Each entry must include at minimum "symbol" and "kind" keys.dict
required
config.paytable dict. Valid symbol names are extracted from this to filter analysis.list
default:"[]"
Additional
gamestate.record() keys to include in the analysis output. Allows hit-rate reporting for custom events beyond symbol wins..xlsx file contains:
- Hit-rates per win range, split by gametype
- RTP contribution per win range
- Simulation counts per win range
- Average payout multiplier per win range
Swap lookups
The optimization algorithm outputs multiple candidate lookup tables under<game>/library/optimization_files/. The swap_lookups utility provides functions to copy weights from a candidate file into the active lookUpTable_<mode>_0.csv file.
File integrity verification
get_file_hash(filepath)
Prints the SHA-256 hash of a single file to the console. Used to verify a file’s contents match the value recorded in config.json.
Directory hash
A companion function prints SHA-256 hashes for all non-Python files within a specified directory. Use this to verify the integrity of an entire game library folder against recorded hash values inconfig.json.
