The gamma-ray burst (GRB) prompt emission is believed to be from highly relativistic electrons accelerated in relativistic shocks. From the GRB high-energy power-law spectral indices β observed by the Burst and Transient Source Experiment (BATSE) Large Area Detectors (LAD), we determine the spectral index, p, of the electrons' energy distribution. Both the theoretical calculations and numerical simulations of the particle acceleration in relativistic shocks show that p has a universal value ≈2.2–2.3. We show that the observed distribution of p during GRBs is not consistent with a δ-function distribution or a universal p value, with the width of the distribution ≥0.54. The distributions of p during X-ray afterglows are also investigated and found to be inconsistent with a δ-function distribution. The p distributions in blazars and pulsar wind nebulae are also broad, inconsistent with a δ-function distribution.