As far as I've figured out from hacking around in the SRAM/RAM....for a Pokemon to be shiny in R/S/LG/FR, the game draws 2 random numbers (words [or 1 dword...not sure], each can be 0 to 65,535 err...the low byte of the first word is used for the gender I think) and then if the first word equals your secret Trainer ID and the second word equals your Trainer ID then, the Pokemon is shiny. So if I'm right...the chances of a shiny Pokemon are 1 in 4,294,967,296 O.O and a player that catches for example, a shiny male Rattata, can never catch a shiny female Rattata. Unless there's something I didn't figure out >.< that kind of number seems a little too large though...
Anyone out there know more about the byte structure of a Pokemon, I know most the stuff related (like changing the gene, effort points, contest stats,experience,item held,markings, Pokemon ID, Pokemon Name etc...), but currently there's a few words in it that I don't quite know the most about (like the gender part and it's relation to shiny Pokemon and changing the grouping of the encrypted dwords)? Any info is greatly appreciated ^-^