Skip to content

Redesign Dice.from_dist to sample density on an evenly-spaced grid#17

Merged
koaning merged 1 commit into
mainfrom
koaning/debug-from-dist-normal
Jul 17, 2026
Merged

Redesign Dice.from_dist to sample density on an evenly-spaced grid#17
koaning merged 1 commit into
mainfrom
koaning/debug-from-dist-normal

Conversation

@koaning

@koaning koaning commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Reworks Dice.from_dist to approximate a continuous distribution by sampling its PDF on an evenly-spaced grid (min/max/step) rather than slicing equiprobable quantiles, so the resulting dice's bar chart reproduces the shape of the density. It now requires a .pdf method (NormalDist or frozen scipy.stats), derives a default mean ± 3·std range when min/max are omitted, and raises clear errors for a non-positive step, an inverted range, or a range that captures no mass. The notebook docs and examples were updated to match, the --watch flag was added to the marimo run command in .conductor/settings.toml, and the tests and formatting were refreshed accordingly.

Replaces the quantile-slicing approach with PDF sampling: one face per
outcome on a min..max grid stepped by `step`, weighted by the density.
This makes the dice's bar chart reproduce the shape of the distribution.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@koaning
koaning merged commit 2627b59 into main Jul 17, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant