RNG & Drop Table


Random Number Generator (RNG)

The Wind Waker makes use of the Wichmann-Hill Pseudo-Random Number Generator (PRNG), presented in pseudocode as follows:

double rng() {
    static int s1 = 100, s2 = 100, s3 = 100;

    s1 = (171 * s1) % 30269;
    s2 = (172 * s2) % 30307;
    s3 = (170 * s3) % 30323;

    return fmod(s1/30269.0 + s2/30307.0 + s3/30323.0, 1.0);
}

This generator makes use of three linear congruential generators that are then combined to produce a distribution between zero and one. This generator is initialized on console reboot to s1 = s2 = s3 = 100, a fixed initial seed. The values of (s1, s2, s3) at any given time determine what the next value of the random number generator will be. We can call this the "state" of the random number generator. Each iteration of the RNG will advance the seed values and generate a new random return value. The first few steps of this process can be seen below:

</tbody></table>

This algorithm generates a sequence that has a period of almost 7×10^12. Due to the fixed initial seed on console reboot, we can determine every random number that the PRNG algorithm will generate for use by the game, and in what exact order. This is useful to beat the Sploosh Kaboom minigame consistently using this tool (external link): Sploosh Kaboom Solver.


Drop Table

When trying to get a random item drop, the game refers to the item drop table. Each actor with random drop refers to a specific drop table ID, that is used to determine both what item it can drop and the odds of dropping it. For example, the rupee pot near Zunari's vending stall on Windfall Island uses drop type 19. Hover over the graph to see which drop you're hovering over corresponds to.

RNG
s1s2s3return value
100 1001000.6930906199656834
17100 17200170000.5253911237999249
18276 1862193150.1491021216452075
7489 2057767540.9526796411193339
9321 23632262290.8229855100670485
19903 356614490.8003992983171554
... .........