I only just found this out. Apparently this has been going on at Smogon for a while. A quick skim of the article reveals the various mechanisms that seed the PRNG (DS system time, etc.) and how to exploit them to get flawless/shiny Pokemon.
http://www.smogon.com/forums/showthread.php?t=52180
SCV's article and code are credited.
[Edit by evandixon]
Smogon recently changed their forum system. Here's the new link (thanks to LEGOanimal22 for the link):
http://smogon.com/forums/threads/rng-research.61090/