It uses OAM DMA hijacking to constantly write the random value of a d-sum address (specifically FFD3) in the main encounter table at D888.
Code
Upon using your arbitrary code execution item, the encounters are randomized until the game is powered off, but sprites are broken.Item 3: Glitch item 0xC3 ("H" in Red, no legible name in Blue) x40
Item 4: TM11 x(any)
Item 5: (any) x (any)
Item 6: Glitch item 0x00 ("j.") x 0
Item 7: Thunderstone x136
Item 8: TM16 x240
Item 9: TM11 x1
Item 10: Potion x0
Item 11: TM05 x224
Item 12: Max Revive x33
Item 13: "PC" x255
Item 14: Lemonade x201
Item 15: Water Stone x 62
Item 16: Water Stone x34
Item 17: Lemonade x211
Item 18: Water Stone x62
Item 19: TM05 x 234
Item 20: "PC" x255
Item 21: TM01 x 97
GameShark codes
The following codes give the player a -g m (0x6A), which is automatically bootstrapped to item 6. Upon using it, the encounters are randomized until the game is powered off, but sprites are broken.01c322d3 012823d3 01d324d3 010028d3 010029d3 01212ad3 01882bd3 01d82cd3 01f02dd3 01d32ed3 01012fd3 011430d3 010031d3 01cd32d3 01e033d3 013634d3 012135d3 018036d3 01ff37d3 013e38d3 01c939d3 01223ad3 013e3bd3 01223cd3 01223dd3 013e3ed3 01d33fd3 012240d3 013e41d3 01cd42d3 01ea43d3 018044d3 01ff45d3 01c946d3 016a1ed3 01c347da 012a48da 01d349da