Deterministic elf name generator uses a hash so the same input always yields the same name
A developer built a Christmas toy that turns a first name and birth month into a two-part elf name and a workshop job. The core design rule was that identical inputs must always produce identical output, so the tool avoids Math.random() and relies on a deterministic hash instead. Input is normalised by trimming, collapsing whitespace and lowercasing before a 32-bit FNV-1a style hash selects an index into each word list. Each pick is salted separately so the name parts and job title stay roughly independent, and unsigned shifts keep array indexes non-negative. The tool runs entirely in the browser with no backend, and the author invites readers to share their own repeatable-random techniques.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in