As I mentioned above, one of its uses is to determine whether or not a random battle is triggered.
There's a danger meter, (2 Bytes) that might increase each time you take a step. There's also the position which is increased each time you take a step (1 Byte) & also an offset (1 Byte) which is incremented by 0x11 (17 dec) every time there's an overflow in the position. (Since 17 is a prime number, it makes possible up to 65,536 [256*256] numbers before having the list repeated).
When playing, there are 3 addresses to watch for:
7E16A8 XXXX = Danger
7E0B4F XX = Steps
7E0B5F XX = Steps Overflow Offset
Determining a random encounter:
1. Walk 1 tile
2. Increment "Danger" counter (can be by 0x0010, 0x0040, 0x00E0, 0x0100 or 0x0180 depending on tile)
3. Increment "Steps" counter by 1
4. Use the LUT to take a value to compare using "Steps" as index ( LUT[Steps] )
5. (Add value on 4. with overflow offset) mod 256 (to remain as 1 Byte)
6. Compare result from 5. with the high byte of "Danger" (so is 1 Byte against 1 Byte)
7. If "Danger" is higher than result, then random battle is triggered.
The "Danger" value is always reset after certain events like a transition of screen (new room), opening map or menu (ONLY in world map) or after a battle (can be random or forced).
This explains why is possible to evade battles, which can be exploited on the GBA with the soft reset. And also explains why there isn't a counter that determines how many steps are needed for the next random battle.
This information was explained in 2012 by Omnigamer in this topic:
http://tasvideos.org/forum/viewtopic.php?p=352775#352775Edit: The danger counter increment seems (so far) to categorize as follow:
0000 - No encounters (Like Towns, save points, etc.)
0010 - Sea
0040 - Ghost Towns (Only parts of: Karnak Castle, Lonka Ruins & Ancient Pyramid)
00E0 - Dungeons
0100 - Outworld
0180 - Moogle Sands