RNG: Difference between revisions

476 bytes added ,  10 October 2018
Line 21: Line 21:
</nowiki>
</nowiki>
===Description===
===Description===
The function
[[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.
 
==Objects that call RNG==
==Objects that call RNG==
* [[Dust]] calls RNG to determine its resultant [[angle]] and [[horizontal speed]]. Note that the dust itself calls RNG, not the [[dust spawner]].
* [[Dust]] calls RNG to determine its resultant [[angle]] and [[horizontal speed]]. Note that the dust itself calls RNG, not the [[dust spawner]].