Skip to content

Instantly share code, notes, and snippets.

@colmmacc
colmmacc / shardcalc.py
Last active January 17, 2025 15:35
Calculate the blast radius of a shuffle shard
import sys
# choose() is the same as computing the number of combinations. Normally this is
# equal to:
#
# factorial(N) / (factorial(m) * factorial(N - m))
#
# but this is very slow to run and requires a deep stack (without tail
# recursion).
#