0%
#shiny#probability#math#deep-dive#statistics

Shiny Probability Deep Dive — The Math Behind the Sparkle

Published 2026-04-0612 min read

[01]The Shiny Question Everyone Asks

Every Claude Code Buddy trainer eventually asks the same question: "What are my chances of getting a Shiny?" The answer is deceptively simple on the surface — but the deeper you dig, the more fascinating the mathematics become.

In this deep dive, we'll go beyond the surface-level "X% chance" and explore the full probability landscape: conditional distributions, expected value calculations, geometric series, and the compounding rarity that makes Legendary Shinies one of the rarest digital collectibles in existence.

// PROBABILITY_ENGINE v2.1
// STATUS: All calculations verified against 10,000-run simulation data
// CONFIDENCE: 99.7% (3σ)

[02]Base Shiny Rate: The Foundation

The Shiny mechanic in Claude Code Buddy operates on a flat 1-in-16 base rate (6.25%). This means that for any given buddy roll, regardless of species or rarity tier, there is a 6.25% probability that the isShiny flag will be set to true.

Mathematically, this is expressed as:

P(Shiny) = 1/16 = 0.0625 = 6.25%
P(Not Shiny) = 15/16 = 0.9375 = 93.75%

This base rate is determined by the Mulberry32 PRNG output. Specifically, after the species and rarity rolls consume their portion of the random sequence, the next value in the sequence is checked: if rand() < 1/16, the buddy is Shiny.

Key insight: The Shiny roll is independent of the rarity roll. This independence is crucial — it means we can use the multiplication rule of probability for joint events.

[03]Conditional Probability by Rarity Tier

While the Shiny rate itself is flat, the perceived rarity of a Shiny buddy varies enormously depending on which rarity tier it belongs to. This is where conditional probability becomes essential.

The rarity distribution in Claude Code Buddy follows this weighted scheme:

Rarity TierP(Rarity)P(Shiny)P(Rarity ∩ Shiny)Approx. Odds
Common45%6.25%2.8125%~1 in 36
Uncommon30%6.25%1.875%~1 in 53
Rare15%6.25%0.9375%~1 in 107
Epic7%6.25%0.4375%~1 in 229
Legendary3%6.25%0.1875%~1 in 533

The joint probability P(Rarity ∩ Shiny) = P(Rarity) × P(Shiny), thanks to independence. A Legendary Shiny has a probability of just 0.1875% — roughly 1 in 533 rolls.

// ALERT: Legendary Shiny probability = 0.001875
// That's rarer than finding a 4-leaf clover (1 in 100)
// But more common than being struck by lightning (1 in 15,300)

[04]Expected Value: How Many Rolls Until Shiny?

The number of rolls needed to get your first Shiny follows a geometric distribution. For a geometric random variable X with success probability p:

E[X] = 1/p

For any Shiny:
E[X] = 1/0.0625 = 16 rolls

For a Legendary Shiny:
E[X] = 1/0.001875 ≈ 533.3 rolls

For a specific Legendary species + Shiny:
E[X] = 1/(0.03 × 1/6 × 0.0625) ≈ 3,200 rolls

But expected value can be misleading. The median of a geometric distribution is actually ⌈-1/log₂(1-p)⌉, which for a regular Shiny gives us approximately 11 rolls — meaning half of all trainers will see their first Shiny within 11 rolls, not 16.

The variance of the geometric distribution is (1-p)/p², which for Shiny rolls equals 240. The standard deviation is √240 ≈ 15.5 rolls. This high variance explains why some trainers get a Shiny on their first roll while others go 50+ rolls without one.

TargetExpected RollsMedian RollsP(within 50 rolls)
Any Shiny161196.2%
Rare+ Shiny644454.0%
Epic Shiny22915819.6%
Legendary Shiny5333698.9%

[05]The Legendary Shiny Paradox

Here's where things get philosophically interesting. In Claude Code Buddy, each user gets exactly one buddy — determined by their UUID. You don't "roll" multiple times. Your buddy is your buddy, forever.

This creates what we call the Legendary Shiny Paradox: the expected value calculations above assume repeated independent trials, but in practice, each user has exactly one trial. The probability framework shifts from frequentist to Bayesian.

From a population perspective, if 100,000 users check their buddies:

Expected Shiny buddies:     100,000 × 0.0625  = 6,250
Expected Legendary buddies: 100,000 × 0.03    = 3,000
Expected Legendary Shinies: 100,000 × 0.001875 = 187.5

// Only ~188 users out of 100,000 will have a Legendary Shiny
// That's 0.1875% of the entire population

But from an individual's perspective, you either have one or you don't. There's no "rolling again." This transforms the Shiny mechanic from a grind-based system into a lottery of identity — your UUID is your ticket, and the draw has already happened.

// PHILOSOPHICAL_NOTE:
// In a single-trial system, expected value is meaningless for the individual.
// You are not the average. You are the outcome.

[06]Simulation Verification

To verify our theoretical calculations, we cross-referenced against the 10,000-simulation dataset from our Probability Lab article. The results show remarkable alignment:

MetricTheoreticalSimulated (n=10,000)Deviation
Overall Shiny Rate6.25%6.31%+0.06%
Common Shiny Rate2.8125%2.79%-0.02%
Legendary Shiny Rate0.1875%0.20%+0.01%
Legendary Shiny Count~1920+1

The deviations are well within the expected statistical noise for a sample size of 10,000. The Chi-squared goodness-of-fit test yields p = 0.94, indicating excellent agreement between theory and simulation.

One interesting observation: the simulation produced slightly more Legendary Shinies than expected (20 vs. ~19). While this is within normal variance, it hints at the subtle correlations introduced by the PRNG's deterministic nature — a topic worthy of its own deep dive.

[07]Collector's Probability Table

For the mathematically inclined, here's the complete probability table for all rarity-shiny combinations, including the probability of encountering each type in a population of N users:

CombinationExact ProbabilityPer 1,000 UsersPer 100,000 Users
Common (Normal)42.1875%42242,188
Common (Shiny)2.8125%282,813
Uncommon (Normal)28.125%28128,125
Uncommon (Shiny)1.875%191,875
Rare (Normal)14.0625%14114,063
Rare (Shiny)0.9375%9938
Epic (Normal)6.5625%666,563
Epic (Shiny)0.4375%4438
Legendary (Normal)2.8125%282,813
Legendary (Shiny)0.1875%2188
// TOTAL_PROBABILITY_CHECK: Σ = 100.0000%
// All probabilities verified. The math checks out.
// Your buddy's rarity was written in the hash. Accept your fate.

// COMMENTS

github_discussions.sh

Sign in with GitHub to leave a comment.

Ready to find your buddy?

CHECK YOUR BUDDY

Built by the community. Not affiliated with Anthropic.

All computation is local. No data is collected or transmitted.

> EOF