Constrainedrandom - a Python package that does what it says on the tin
summary
A Python package that solves constrained-random generation by walking the state space randomly rather than exhaustive solving, giving about a 10x speedup over PyVSC in the author’s benchmarks. It exposes rand objects, seeded instance or global RNGs, domains, weighted distributions and arbitrary Python constraints. Solver strategy is staged: naive random trials, a sparse graph fallback, then exhaustive PiConstraints (which can fail or be impossibly large for 64‑bit ranges). Used to migrate a real RISC‑V DV flow; works fast for typical problems but can not converge on very large or hard CSPs.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:04Procedural randomization limits
- 2:06Declarative style
- 3:09Design principles
- 4:34Adding variables and constraints
- 6:38Advanced features
- 8:02Performance benchmarks
- 9:26Limitations and future
- 10:51Q&A
related talks
21mTry A Little Randomness
28mRandomness in Python: Controlled Chaos in an Ordered Machine
27mUsing Random Forests in Python
30mreliable testing with pip constraints
01h 30mHow To Write a Rubik’s Cube Solver
29mSolving an NP-Hard Problem for Fun and Profit
29mI wish I learnt that earlier!
41mLuxuries, necessities, and the challenges that remain
