I have a game I am working on. There is one random seed generated at some point. At later point, I want to use this seed to derive some attributes like
defense of a character.
I want attributes to not be correlated to each other. One way I thought of is using hash functions like so:
const attackHex = createHash('md5') .update(seed) .update('attack') .digest('hex') const attack = Number(attackHex); console.log('attack', attackHex, attack) const defenseHex = createHash('md5') .update(seed) .update('defense') .digest('hex') const defense = Number(defenseHex); console.log('defense', defenseHex, defense)
attack 73341812d1bd6fc73c022b4971618c27 NaN defense 0620fbd637b7cf2f7d83dc3c8d5f8528 NaN
But the number conversion is not too happy… I guess it is too big of a number.
I would appreciate any help.