When you catch a monster, a 16 bit value is randomly generated. This means the gameboy pulls a number somewhere between 0 and 65535 out of its electronic ass. We currently believe that all numbers are equally likely: at the same time, a concentrated study would doubtless reveal statistical errors, as it uses a psuedorandom table almost assuredly (don't encrypt state secrets with it, or generate one time pads!).
This number is stored with your monster, is one of many factors that determines your stats at any given moment. I'm not going to go into detail here about the other sources (that's posted plenty of places), but I'll talk about the genes:
You have five genes, one for each statistic. Each one ranges from 0-15 (a four bit value). The amount of points any given stat gets from it's respective gene value is proportional with your level divided by 50: basically twice your level. So a level 100 monster with an attack gene of 15 has an attack 30 points higher than if it had been zero.
You can figure out your monsters genes by controlling all the variables in the formula except the gene value itself: this means either none or full stat EXP (so you will get the 63 points at level 100 or not) and a chart (like at greycloak's skills/statfinder at http://skill-statfinder.virtualave.net/ssf/ ) to refer to the base value and then find out what it would have to be.
A popular thing is to rare candy your monster to Level 50 (so that it has no stat EXP, as it never fought in a battle), then just subtract the base score... you can see this by looking at the formulas here: http://www.geocities.com/marcusmajarra/mechanics.html .
Here's the other confusing thing. You have a 16 bit value, right? Let's label the bits:
Now, if you count, you will find 16 bits there. Bits 0,1,2 and 3 go in that order to form your attack gene. Bits 4,5,6 and 7 go in that order to form your defense gene. Bits 8,9,A, and B go in that order to form your speed gene, and bits C,D,E, and F go in that order to form your special gene. Because they needed one more, they reused bits alread used: bits 3,7,B, and F are used in that order for your hitpoint gene. This means you can't have a monster that has max attack, defense, speed, and special without also having max hitpoints.
Note that bits 3,7,B, and F also determine whether the attack, defense, speed, and special genes are odd or even (a "1" makes them odd and gives you more hitpoints). Having every bit of the 16 (a 1/65536 chance shot) equal to "1" means that you get max stats.
If you have further questions, feel free to ask. I'm moving this back to Sakaki tower, where I plain old didn't see it
By the way, I assume you want to know how to modify them with gameshark (it seems to be popular , plus you originally posted here). The basic max stats page is here: http://www.math.miami.edu/~jam/azure/weird/maxstats.htm , but you may have already known that.
"That's an awesome cape too, look, it's black and white!"
-pkthunder, on Lance's cape in the Gameboy version
[This message has been edited by cfalcon (edited 07-21-2000).]