video by Mario 64 expert PannnenKoek explains, simply and cleanly, how the
game produces random numbers, using a means called a linear shift
register. It is an excellent example
of how such values are created in production software.|
Mario 64 is an action game in which randomness does not typically play a huge role, so it doesn't require a "strong" source of randomness, or a large period, to provide effectively varied values. It performs its creation of "pseudorandom" values using a means that takes a seed value, performs a few elementary mathematical and logical operations to it, returns the value to the object that needs it, then stores the value as the new seed. The implications of this system are that random events in the game tend to follow cycles, that generally aren't noticeable because of varying numbers of objects seeking random numbers, and because the period (the time between repeats) is long enough to not be noticed (often from 7 to 20 minutes).