The hook-walk algorithm (Greene-Nijenhuis-Wilf) generates uniformly random Standard Young Tableaux (SYT) of any given shape. This is a fundamental tool in algebraic combinatorics with applications to representation theory, symmetric functions, and random matrix theory.
How it works:
Start with an empty Young diagram of the given shape
For each number k from N down to 1:
Pick a random starting cell uniformly from all empty cells
Perform a random walk within the hook: move right or down with probabilities proportional to arm and leg lengths
Stop when reaching a corner cell (arm = leg = 0)
Place k at that corner and remove it from the diagram
Properties:
Uniform sampling: Each SYT of the given shape has equal probability
Efficient: O(N√N) time complexity for N boxes
Scalable: Handles shapes up to 100,000 boxes using WASM
Shape input methods:
Draw Shape: Click cells on the interactive grid to draw Young diagrams by hand
Manual notation: Enter row lengths like 5,5,5 or 100^50
Plancherel measure: Sample random partitions by discretizing the Vershik-Kerov limit shape Ω(x) = (2/π)[x√(1-x²) + arcsin(x)]
Visualization:
Small tableaux (≤200 boxes): Individual numbers displayed in cells
Large tableaux (>200 boxes): Heat map showing value distribution by deciles
Draw only the outline; interior is auto-filled.
Current boxes: 0
Samples random partition with Plancherel measure
Generates staircase shape k, k-1, ..., 1
Generating SYT...
code
(note: parameters in the code might differ from the ones in
simulation results below)
Link to code
(This simulation is interactive, written in JavaScript, see the source code of this page at the link)
Link to code
(C++ code for WASM module (samples SYT up to 100 000 boxes))
Dear colleagues:
Feel free to use code (unless otherwise specified next to the corresponding link),
data, and visualizations to illustrate your research in talks and papers,
with attribution (CC BY-SA 4.0).
Some images are available in very high resolution upon request.
I can also produce other simulations upon request - email me at lenia.petrov@gmail.com
This material is based upon work supported by the National Science Foundation under Grant DMS-2153869