System RNG: Difference between revisions

From Final Fantasy VII Speedrun Wiki
Jump to navigation Jump to search
m (1 revision imported: Import from old wiki)
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:


=== PSX ===
=== PSX ===
PSX System RNG is provided by the PlayStation's BIOS. It is a Linear Congruential Generator with a multiplier of 0x41C64E6D (1103515245), an addend of 0x3039 (12345), and returns bits 30 through 16.
PSX System RNG is provided by the PlayStation's BIOS. It is a Linear Congruential Generator with a multiplier of 0x41C64E6D (1103515245), an addend of 0x3039 (12345), an implicit modulus of 4294967296 (2^32), and returns bits 30 through 16.


=== PC ===
=== PC ===
PC System RNG is provided to the PC version of Final Fantasy VII by the compiler used to build the game. It is a Linear Congruential Generator with a multiplier of 0x343FD (214013), an addend of 0x269EC3 (2531011), and returns bits 30 through 16.
PC System RNG is provided to the PC version of Final Fantasy VII by the compiler used to build the game. It is a Linear Congruential Generator with a multiplier of 0x343FD (214013), an addend of 0x269EC3 (2531011), an implicit modulus of 4294967296 (2^32), and returns bits 30 through 16.


== Uses ==
== Uses ==


=== Seeding Battle RNG ===
=== Seeding Battle RNG ===
On the PC version, [[Battle RNG]] is seeded using the result of a call to System RNG.

Latest revision as of 06:26, 26 November 2024

System RNG refers to the Random Number Generator provided to the game from an external source. These are analogous to each other, but have different implementations and subtle differences in use between platforms.

All implementations are a form of Linear Congruential Generator that returns an integer value uniformly distributed in the range [0, 32767], but they have different constants.

Implementations[edit | edit source]

PSX[edit | edit source]

PSX System RNG is provided by the PlayStation's BIOS. It is a Linear Congruential Generator with a multiplier of 0x41C64E6D (1103515245), an addend of 0x3039 (12345), an implicit modulus of 4294967296 (2^32), and returns bits 30 through 16.

PC[edit | edit source]

PC System RNG is provided to the PC version of Final Fantasy VII by the compiler used to build the game. It is a Linear Congruential Generator with a multiplier of 0x343FD (214013), an addend of 0x269EC3 (2531011), an implicit modulus of 4294967296 (2^32), and returns bits 30 through 16.

Uses[edit | edit source]

Seeding Battle RNG[edit | edit source]

On the PC version, Battle RNG is seeded using the result of a call to System RNG.