Skip to content

Instantly share code, notes, and snippets.

@tedtieken
Created September 15, 2013 00:50
Show Gist options
  • Select an option

  • Save tedtieken/6567112 to your computer and use it in GitHub Desktop.

Select an option

Save tedtieken/6567112 to your computer and use it in GitHub Desktop.

Revisions

  1. tedtieken created this gist Sep 15, 2013.
    23 changes: 23 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    import random

    envs = [10.0, 20.0]

    rounds = 10000
    total_stay = 0
    for x in xrange(rounds):
      t_envs = envs[:]
      random.shuffle(t_envs)
      choice = t_envs.pop()
      total_stay += choice

    total_switch = 0
    for x in xrange(rounds):
      t_envs = envs[:]
      random.shuffle(t_envs)
      choice = t_envs.pop()
      new_choice = t_envs.pop()
      total_switch += new_choice

    d_rounds = rounds * 1.0
    print total_stay / d_rounds 
    print total_switch / d_rounds