What you're watching
Every time step, each atom gets a random number between 0 and 1. If it's below the survival chance q, the atom stays radioactive. If not, it decays and becomes stable.
No one can predict when a single atom will decay. But the whole group follows the exact formula almost perfectly. That's how scientists know how long waste must be stored.
Why it matters for nuclear waste
Short half-life means intense but brief. Iodine-131 is fiercely radioactive, then almost gone in about 80 days. Long half-life means long-lasting but weak. Plutonium-239 lasts tens of thousands of years because it decays slowly, which also means it gives off radiation slowly.
After 10 half-lives, about 0.1% of any isotope is left. Used fuel's overall radioactivity drops fastest in its first years.
The code behind it
def decay(N):
population = []
for t in range(100):
r = np.random.random(N)
survive = np.sum(r < q)
population.append(survive)
N = survive
return population
The same loop from the tutorial, rewritten in JavaScript so it runs in the browser.