Difference between revisions of "SIBR:Random number generator"
(Created page with "The Blaseball backend uses a pseudorandom number generator called XorShift128+ to generate rando...") |
|||
Line 2: | Line 2: | ||
XorShift128+ is not [[Wikipedia:Cryptographically-secure pseudorandom number generator|cryptographically secure]]. With three known consecutive outputs, the RNG state can be fully reconstructed,<ref>https://blog.securityevaluators.com/hacking-the-javascript-lottery-80cc437e3b7f</ref> allowing us to determine what all subsequent values would be. Furthermore, the algorithm is fully reversible so we can determine all preceding values as well.<ref>https://blog.securityevaluators.com/xorshift128-backward-ff3365dc0c17</ref> Using this technique, we can select a player whose earliest recorded stats were unchanged since generation, recover the RNG state from when that player was created, and examine the surrounding values to find stats for other players that were created at the same time. | XorShift128+ is not [[Wikipedia:Cryptographically-secure pseudorandom number generator|cryptographically secure]]. With three known consecutive outputs, the RNG state can be fully reconstructed,<ref>https://blog.securityevaluators.com/hacking-the-javascript-lottery-80cc437e3b7f</ref> allowing us to determine what all subsequent values would be. Furthermore, the algorithm is fully reversible so we can determine all preceding values as well.<ref>https://blog.securityevaluators.com/xorshift128-backward-ff3365dc0c17</ref> Using this technique, we can select a player whose earliest recorded stats were unchanged since generation, recover the RNG state from when that player was created, and examine the surrounding values to find stats for other players that were created at the same time. | ||
+ | |||
+ | ==Player generation== | ||
+ | When a new player is created, their attributes are generated by a series of consecutive rolls in the following order: | ||
+ | |||
+ | <pre>first name | ||
+ | last name | ||
+ | thwackability | ||
+ | moxie | ||
+ | divinity | ||
+ | musclitude | ||
+ | patheticism | ||
+ | buoyancy | ||
+ | baseThirst | ||
+ | laserlikeness | ||
+ | groundFriction | ||
+ | continuation | ||
+ | indulgence | ||
+ | martyrdom | ||
+ | tragicness | ||
+ | shakespearianism | ||
+ | suppression | ||
+ | unthwackability | ||
+ | coldness | ||
+ | overpowerment | ||
+ | ruthlessness | ||
+ | omniscience | ||
+ | tenaciousness | ||
+ | watchfulness | ||
+ | anticapitalism | ||
+ | chasiness | ||
+ | pressurization | ||
+ | cinnamon, if player has 'cinnamon' field | ||
+ | soul = floor(rand()*8+2) | ||
+ | allergy = rand() < 0.5, if player has 'peanutAllergy' field | ||
+ | fate = floor(rand()*100), if player has 'fate' field | ||
+ | ritual (value unknown), if s12 or later | ||
+ | blood = floor(rand()*13), if s12 or later | ||
+ | coffee = floor(rand()*13), if s12 or later</pre> | ||
---- | ---- | ||
<references/> | <references/> |
Revision as of 13:02, 18 August 2021
The Blaseball backend uses a pseudorandom number generator called XorShift128+ to generate random values. These values are used for a variety of purposes, including attributes for newly-hatched players and determining event outcomes during games.
XorShift128+ is not cryptographically secure. With three known consecutive outputs, the RNG state can be fully reconstructed,[1] allowing us to determine what all subsequent values would be. Furthermore, the algorithm is fully reversible so we can determine all preceding values as well.[2] Using this technique, we can select a player whose earliest recorded stats were unchanged since generation, recover the RNG state from when that player was created, and examine the surrounding values to find stats for other players that were created at the same time.
Player generation
When a new player is created, their attributes are generated by a series of consecutive rolls in the following order:
first name last name thwackability moxie divinity musclitude patheticism buoyancy baseThirst laserlikeness groundFriction continuation indulgence martyrdom tragicness shakespearianism suppression unthwackability coldness overpowerment ruthlessness omniscience tenaciousness watchfulness anticapitalism chasiness pressurization cinnamon, if player has 'cinnamon' field soul = floor(rand()*8+2) allergy = rand() < 0.5, if player has 'peanutAllergy' field fate = floor(rand()*100), if player has 'fate' field ritual (value unknown), if s12 or later blood = floor(rand()*13), if s12 or later coffee = floor(rand()*13), if s12 or later