Show HN: I Ching simulator with accurate Yarrow Stalk probabilities
Hacker News (score: 16)Description
Technical detail for the curious:
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.
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.
I was worried this 'human bias' might skew the modulo probabilities, so I ran a 1-million-run Monte Carlo simulation to verify.
The Result: The remainders [0,1,2,3] still emerged with a near-perfect 25% distribution (deviation < 0.05%).
So, the app simulates the physics of human imperfection while preserving the mathematical perfection of the probability distribution (where Old Yin is 1/16).
Stack: Next.js + Tailwind css
Happy to answer any questions about the math or the hexagrams!
More from Hacker
Generate QR Codes with Pure SQL in PostgreSQL
Generate QR Codes with Pure SQL in PostgreSQL
Obelisk 0.32: Cancellation, WebAPI, Postgres
Obelisk 0.32: Cancellation, WebAPI, Postgres
Show HN: A Claude Code plugin that catch destructive Git and filesystem commands
Show HN: A Claude Code plugin that catch destructive Git and filesystem commands
Show HN: Rust/WASM lighting data toolkit – parses legacy formats, generates SVGs
Show HN: Rust/WASM lighting data toolkit – parses legacy formats, generates SVGs Hi HN, I'm Holger, a developer who worked in the lighting industry.<p>I built this to scratch my own itch and put it on crates.io and PyPI where nothing like it existed.<p>The old file formats (EULUMDAT from 1990, IES from 1991) still work fine for basic photometry. But the industry is moving toward spectral data – full wavelength distributions instead of just lumen values.<p>The new standards (TM-33, ATLA-S001) are barely supported by existing tools.<p>So this handles both: legacy formats for compatibility, spectral data for anyone who wants to work with the new standards.<p>Stack: Rust core, then UniFFI for bindings. One codebase compiles to WASM/Leptos, egui, SwiftUI, Jetpack Compose, PyO3.<p>At one point the generated Swift boilerplate got so large GitHub classified it as a Swift project. 3D viewer is Bevy, loaded on-demand.<p>Feedback welcome – especially on the SVG output and the 3D viewer.<p><a href="https://github.com/holg/eulumdat-rs" rel="nofollow">https://github.com/holg/eulumdat-rs</a> (MIT/Apache-2.0)
No other tools from this source yet.