>>14506367
>testes evolve in fish without endothermy
>testes optimize for peak efficiency at those temperatures
>testes are inherited by fish lineages which lead to amphibians, amniotes, therapsids, synapsids, and early mammalians
>as mammals develop endothermy and increase their body temperatures to be more active at night, the efficiency of the testes is decreased
>through random selection, some mammal lineages evolve to have their testes pushed against their abdominal cavity, increasing their distance from the animal's peak core temperature
>mammals with testes farther from the abdomen can increase their core temp without decreasing fertility, increasing fitness
>the scrotum develops as a result, and the more transitional lineages of mammals with internal testes are out-competed
in short we have external balls today because in the deep past our ancestors managed to evolve the ball sac before they evolved heat-tolerant balls.