SIBR:Random number generator

From Blaseball Wiki

Revision as of 13:02, 18 August 2021 by Pokeylope (talk | contribs)

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