V(D)J Recombination

V(D)J recombination, also known as somatic recombination, is a mechanism of genetic recombination in the early stages of immunoglobulin (Ig) and T cell receptors (TCR) production of the immune system. V(D)J recombination takes place in the primary lymphoid tissue (the bone marrow for B cells, and Thymus for T cells).V(D)J recombination nearly randomly combines Variable, Diverse, and Joining gene segments of vertebrates, and because of its randomness in choosing different genes, is able to diversely encode proteins to match antigens from bacteria, viruses, parasites, dysfunctional cells such as tumor cells, and pollens.

Read more about V(D)J Recombination:  Background, In T Cell Receptors