How Do Slot Machines Work: The Math Behind it All