Same account ID, same pet: how a deterministic buddy checker works
If two people type the same account ID into the same function, they should get the same answer every time. That's the entire spec for the checker on Claude Buddy Community Hub , a fan-made site for the /buddy pet inside Claude Code. It's a fun little problem, and it has a few lessons that apply to any "deterministic random" feature. Hash the ID, seed a PRNG Your buddy isn't a fresh roll each time…
If two individuals input the same account ID into the same function, they should obtain the identical result every time, according to the specification for the checker on Claude Buddy Community Hub. This is a straightforward concept applicable to any deterministic random feature. The buddy pet is not a fresh roll each time it is hatched; its identity is derived from the account's unique identifier (UUID), ensuring that the same account consistently receives the same pet. Consequently, no data needs to be stored, as the result can be recalculated from the ID alone.
The checker page outlines the structure of the process: the account UUID is combined with a salt, then fed into a pseudo-random generator that determines the pet's species, rarity, eyes, hat, and five stats. There are 18 possible species. The author highlights that the hash function used can vary between different runtimes. For instance, Node.js (FNV-1a) is currently supported, while Bun (wyhash) is anticipated to be added soon.
This emphasizes that the term "deterministic" refers to yielding the same pet when the same hash function is employed. However, if two distinct runtimes hash the same string differently, they will generate different pets, and neither outcome is incorrect.
Rarity levels range from Common (60%), Uncommon (25%), Rare (10%), Epic (4%), and Legendary (1%). The rarity page includes a small probability calculator. A Legendary rarity is 1%, while a specific Legendary species has a slightly lower probability of 0.056%. A Shiny rarity is an additional 1%, so the combined probability of obtaining a Legendary species combined with Shiny is 0.01%.
Adding a specific species further reduces the probability to 0.0006%. The author notes that while the calculation may seem straightforward, it's easy for readers to misinterpret "1%" as "2%", when the actual figure is 0.01%. Therefore, the page includes the calculations alongside the information to provide clarity.
One common issue users may encounter is receiving a different pet than what they see in their terminal. The guide explains the likely causes: there are two IDs in the configuration file, accountUuid and userID. Team or Pro accounts should use accountUuid. Users can locate this ID using the command "grep accountUuid ~/.claude.json".
The other potential cause mentioned is the use of a reroll tool that alters the local salt, which inherently changes the output of the deterministic function. The generator itself consists of a few lines of logic. Therefore, providing precise instructions, fallback options, and troubleshooting steps for when the result still does not match is crucial.
This page serves as a real-world application of a deterministic function, demonstrating that the reliability of such a feature hinges significantly on the input provided by users.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.