Cells sometime adapt to challenging environments by turning non-functional loci into functional genes in a process termedde novogene birth. But how proteins with random amino acid sequences integrate into existing cellular pathways to provide a benefit remains poorly understood. Here, we screened ~108random genes for their ability to rescue growth arrest ofE. colicells producing the ribonuclease toxin MazF. Approximately 2,000 random genes could promote growth by reducing transcription from the promoter drivingmazFexpression. Additionally, one gene, namedrandomantitoxin ofMazF(ramF), whose protein product was well-tolerated in cells and neutralized MazF by interacting with chaperones, leading to MazF proteolysis. We show that the specificity of RamF for MazF relative to other toxins relies on the degron-like function of MazF's first 10 amino acids. Finally, we demonstrate that random proteins can improve during evolution by identifying beneficial mutations that turned RamF into a more efficient inhibitor. Our work provides a mechanistic basis for howde novogene birth can produce new, functional proteins that are integrated into complex cellular systems and provide a benefit to cells.