Circuit design in biology and machine learning. I. Random networks and dimensional reduction