All puzzles › Seeded Randomness and Hashing
Seeded Randomness and Hashing Practice Problems
5 puzzles (2 easy, 3 medium), in Python, JavaScript and C++.
Two players, one jigsaw, cut identically on both machines. Hashing, a seeded generator, an unbiased shuffle, and why determinism here is a correctness requirement rather than a nicety.
The puzzles, easiest first
- As Even As It Gets (Easy): Given a total number of lines and a number of pieces, return the size of each piece, as even as possible.
- The Next Number (Easy): Given a seed, return the next one: multiply by 1664525, add 1013904223, and keep the low 32 bits.
- A Name Becomes a Number (Medium): Given a puzzle name, return a 32-bit seed.
- Shuffle Without Bias (Medium): Given a list and a list of draws, shuffle the list and return it.
- Vary It, But Do Not Break It (Medium): Given piece sizes, a list of moves, and a max size, apply the moves and return the new sizes.
Practice another pattern
Or browse by subject
Browse all 676 puzzles