RNG: Difference between revisions

392 bytes added ,  10 October 2018
→‎Description: finish adding data
(→‎Description: finish adding data)
Line 22: Line 22:
===Description===
===Description===
[[File:RNG Graph.png|500px|right|A graph showing notable RNG values and indeces in SM64.]]
[[File:RNG Graph.png|500px|right|A graph showing notable RNG values and indeces in SM64.]]
The function has 65536 possible inputs and 65536 possible outputs. It is a bijection, meaning that every input maps to exactly one output and none repeat or are left out. The function forms two loops, one of length 65534 and one of length 2, but one of the if statements causes the cycle of 2 to lead back to the cycle of 65534. Oddly, the RNG value of 21674 at index 65113 loops back to index 0.
The function has 65536 possible inputs and 65536 possible outputs. It is a bijection, meaning that every input maps to exactly one output and none repeat or are left out. The function forms two loops, one of length 65534 and one of length 2, but one of the if statements causes the cycle of 2 to lead back to the cycle of 65534. Oddly, the RNG value of 21674 at index 65113 loops back to index 0. This may be because this index's S1 value is equal to the previous RNG value for the first time, but that is no reason to prematurely end the loop. Indeces 65114-65533, as well as values 22026 and 58704 (the loop of 2,  which are not given indeces) are considered '''impossible RNG values''' and cannot be reached without hacking. The RNG index and value of 0 is set when the game powers on.


==Objects that call RNG==
==Objects that call RNG==