When the big bang happened, Quarks were scattered across the universe by high energy photons, in order for the universe to reach thermodynamic equilibrium, these later formed elements are forced together by gravity, in order to do work, letting the universe eventually becoming completely homogenous.