Distributed acceleration of cosmic rays