Rhythmic spacing and origin of pools and riffles