Im working on a slot machine simulator. Code
The heart of the program is a nested loop like this:
import pandas
for universe in range(10000):
for spins in range(50000):
win = paytable.Multiplier.sample(weights=paytable.Probability)
result.append(win)
Universes are the amount of times the wagering process should be simulated.
Spins are the amount of spins played in each universe.
The program makes a weighted choice from a pandas dataframe to determine if a spin won and how much.
The problem is that I need to execute all these operations to get a large enough sample size and this gets really slow.
I have read some stuff about multiprocessing and vectorization but I have no idea how applicable this is and where to start.