RNG: Difference between revisions

210 bytes removed ,  27 May
m
no edit summary
No edit summary
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 57: Line 57:
|-
|-
|0
|0
|style="background:#9EFF9E;"|1
|{{Yes|1}}
|style="background:#9EFF9E;border-left-width:2px;"|1
|style="background:#9EFF9E;border-left-width:2px;"|1
|-
|-
|style="background:#9EFF9E;"|1
|{{Yes|1}}
|0
|0
|style="background:#9EFF9E;border-left-width:2px;"|1
|style="background:#9EFF9E;border-left-width:2px;"|1
|-
|-
|style="background:#9EFF9E;"|1
|{{Yes|1}}
|style="background:#9EFF9E;"|1
|{{Yes|1}}
|style="border-left-width:2px;"|0
|style="border-left-width:2px;"|0
|}
|}
Line 124: Line 124:
===Properties===
===Properties===
[[File:RNG Graph.png|500px|thumb|A graph showing notable RNG values and indices in SM64.]]
[[File:RNG Graph.png|500px|thumb|A graph showing notable RNG values and indices in SM64.]]
The RNG function has 65536 possible inputs and 65536 possible outputs. It is a [[wikipedia:Bijection|bijection]], meaning that every input maps to exactly one output, and none repeat or are left out.
The RNG function has 65536 possible inputs and 65536 possible outputs. The function forms two loops, one of length 65534 and one of length 2, but one of the [[wikipedia:If statement|if statements]] causes the cycle of 2 to lead back to the cycle of 65534.
 
The function forms two loops, one of length 65534 and one of length 2, but one of the [[wikipedia:If statement|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.
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.
confirmed_editors
135

edits