Skip to content

Instantly share code, notes, and snippets.

@iitalics
Created August 12, 2025 17:23
Show Gist options
  • Select an option

  • Save iitalics/f69e6a68ef9766e0e35f3eb3271a885a to your computer and use it in GitHub Desktop.

Select an option

Save iitalics/f69e6a68ef9766e0e35f3eb3271a885a to your computer and use it in GitHub Desktop.
import random
def simulate():
kc = 0
N = 100000
for i in range(N):
n = 0
while n < 10:
# roll 1
if random.randint(1, 10) == 1:
n += 1
# roll 2
if random.randint(1, 10) == 1:
n += 1
kc += 1
avg_kc = kc / N
return avg_kc
print(simulate())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment