{"by":"jackzhuo","descendants":62,"id":46261942,"kids":[46280224,46284284,46278894,46279220,46278978,46279339,46279249,46279754,46281083,46278930,46280445,46285780,46281018,46280640,46269685,46269249],"score":63,"text":"I built this because I wanted a digital I Ching that honors the original math, rather than just Math.random().<p>Technical detail for the curious:<p>The simulation follows the traditional Yarrow Stalk algorithm (Da Yan). The core of this algorithm relies on modulo-4 arithmetic on the stalks remaining after a random split.<p>To make it physically realistic, I used a Box-Muller transform to simulate the user splitting the stalks with a Gaussian distribution (since humans naturally tend to split near the middle), rather than a uniform random split.<p>I was worried this &#x27;human bias&#x27; might skew the modulo probabilities, so I ran a 1-million-run Monte Carlo simulation to verify.<p>The Result: The remainders [0,1,2,3] still emerged with a near-perfect 25% distribution (deviation &lt; 0.05%).<p>So, the app simulates the physics of human imperfection while preserving the mathematical perfection of the probability distribution (where Old Yin is 1&#x2F;16).<p>Stack: Next.js + Tailwind css<p>Happy to answer any questions about the math or the hexagrams!","time":1765705453,"title":"Show HN: I Ching simulator with accurate Yarrow Stalk probabilities","type":"story","url":"https://castiching.com/"}