Monte Carlo vs Las Vegas — Two Randomized Paradigms, Side by Side

Monte Carlo (left): throw a fixed number of darts to estimate π — fixed time, approximate answer. Las Vegas (right): retry a random draw until it succeeds — always correct, random time.

Monte Carlo: time O(N) fixed, error ~ 1/√N Las Vegas: always correct, expected 1/p attempts
step 0

Monte Carlo — estimating π by darts

darts N = 0  |  inside 0
π ≈ 4·(inside/N) = 0.00000
true π = 3.14159265   abs error =
inside circle outside circle error curve ~ 1/√N

Las Vegas — retry until success

Goal: roll a die until it shows 6. The result is always a 6 (correct); the number of rolls is random.
current run attempts: 0
runs completed: 0  |  total attempts: 0
average attempts = 0.000  (theory 1/p = 6.00)
failed draw (retry) success (return, always correct)
Press Step to advance one event, or Run to animate. Watch the Monte Carlo π estimate tighten as darts accumulate, while the Las Vegas loop retries until it hits the goal — its answer is always right, but the attempt count wobbles around 1/p.
AspectMonte Carlo (π darts)Las Vegas (retry)
Running timeO(N) fixedrandom, E = O(1/p)
Answerapproximate (may err)always correct
Quality metricerror ~ 1/√Nexpected attempts 1/p
Improve bymore darts / amplifyraise p (more good draws)
Tail risknone (fixed time)P[>t] = (1−p)^t
Finishes whenafter N dartson first success

Operation Log

Self-contained visualization — no external dependencies. Left: Monte Carlo spends a fixed amount of work (darts) for an approximate answer whose error shrinks like 1/√N. Right: Las Vegas guarantees a correct answer but pays a random number of attempts, averaging 1/p. See junior.md and middle.md for the trade-off, senior.md for SLA sizing, and professional.md for the RP/ZPP/BPP theory.