I remember learning in microbiology that the human body generates antibodies using a random process so that an enormous variety of antibodies can be produced with a simple genetic code.

Now that I'm trying to learn more about random processes, I find this more interesting than I used to. Has anyone developed a mathematical model for how the genetic code generates these random antibodies? Clearly, we'd like the process to be ergodic, so that as many antibody varieties as possible can be produced. The main reason that I'm interested is because there are so many ways that random and pseudo-random numbers are generated, and it would interesting to see what the body "thinks" is a good random antibody generator.

I did a quick google search, finding links such as this paper, but they seem to assume that antibodies are generated randomly without explaining the mechanism.

So, does anyone know if there is a mathematical model for the process that generates random antibodies?

And, Merry Christmas!

**Edit:** Steve and Tom have provided a great answer and a great comment about related topics that I think provide a good place to start reading. For now, though, I will leave the question open in case someone can provide a fuller answer in the future. **End Edit.**