Skip to content

Instantly share code, notes, and snippets.

@kneth
Created June 12, 2013 07:23
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 kneth/5763426 to your computer and use it in GitHub Desktop.
Save kneth/5763426 to your computer and use it in GitHub Desktop.
Opgave 1A
import random
antal_ens = 0
for _ in range(0, 5000000):
centicubes = ['R', 'H', 'R']
random.shuffle(centicubes)
c1 = centicubes.pop(random.randint(0, len(centicubes)-1))
c2 = centicubes.pop(random.randint(0, len(centicubes)-1))
if c1 == c2:
antal_ens += 1
print antal_ens/5000000.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment