How many rays is enough

Standard error of a Bernoulli vs sample size.

Lesson 3 of 5 · ~7 min read

The escape fraction is a Bernoulli event per ray. Over N rays, the reported fraction p̂ has standard error

SE(p̂) = √( p̂(1 − p̂) / N )

For the lossless-mirror 2·θc/π reference (~46 % at n = 1.52), 1 000 rays give SE ≈ 1.6 pp — fine for a vibe check. 10 000 rays give ~0.5 pp — enough to distinguish a Monte-Carlo run from the analytic reference.

Rule of thumb

  • Design exploration: 1 000 rays. Fast enough to sweep n or geometry.
  • Design sign-off: 10 000 rays. Noise floor well below any decision threshold.
  • Benchmark: 100 000+ rays, seeded. Precision to 0.05 pp — enough to detect a kernel regression.