  We study the generation of magnetic field seeds during a first-order
electroweak phase transition, by numerically evolving the classical equations
of motion of the bosonic electroweak theory on the lattice. The onset of the
transition is implemented by the random nucleation of bubbles with an
arbitrarily oriented Higgs field in the broken phase. We find that about 10% of
the latent heat is converted into magnetic energy, with most of the magnetic
fields being generated in the last stage of the phase transition when the Higgs
oscillates around the true vacuum. The energy spectrum of the magnetic field
has a peak that shifts towards larger length scales as the phase transition
unfolds. By the end of our runs the peak wavelength is of the order of the
bubble percolation scale, or about a third of our lattice size.
