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

  1. 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.
  2. The Next Number (Easy): Given a seed, return the next one: multiply by 1664525, add 1013904223, and keep the low 32 bits.
  3. A Name Becomes a Number (Medium): Given a puzzle name, return a 32-bit seed.
  4. Shuffle Without Bias (Medium): Given a list and a list of draws, shuffle the list and return it.
  5. 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