We present a model of T cell selection based on the assumption of random interaction strengths between a self-peptide and the various T cell receptors. The model enables the analytical study, through the use of extreme value statistics, of the effects of selection on the CTL recognition of TANs and completely foreign peptides. We estimate the number of CTLs that can detect donor-matched transplants. We show that negative selection thresholds chosen to reflect experimentally observed thymic survival rates result in near-optimal production of T cells that are capable of surviving selection and recognizing foreign antigen. These analytical results are confirmed by simulation.