Skip to content

Instantly share code, notes, and snippets.

@adpoe
Created March 14, 2016 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adpoe/451692edd33c81799a52 to your computer and use it in GitHub Desktop.
Save adpoe/451692edd33c81799a52 to your computer and use it in GitHub Desktop.
Geometric Distribution for Carry On Items in Airport Simulation
def gen_number_of_carry_on_items__for_COMMUTER_passenger():
"""
Number of bags a passenger carries is determined using a GEOMETRIC DISTIBUTION
BERNOULLI TRIAL with success bias %p = chance of passenger bringing bags
Bernoulli with 80% chance
P = 0.80 for international
:return: Number of bags a commuter passenger has carried on
"""
# Count number of iterations until a success
counter = 0
successful_trial = 0
while successful_trial == 0:
successful_trial = bernoulli_trial_commuter()
counter += 1
return counter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment