  We study the formation of cosmic strings by confining a stochastic magnetic
field into flux tubes in a numerical simulation. We use overdamped evolution in
a potential that is minimized when the flux through each face in the simulation
lattice is a multiple of the fundamental flux quantum. When the typical number
of flux quanta through a correlation-length-sized region is initially about 1,
we find a string network similar to that generated by the Kibble-Zurek
mechanism. With larger initial flux, the loop distribution and the Brownian
shape of the infinite strings remain unchanged, but the fraction of length in
infinite strings is increased. A 2D slice of the network exhibits bundles of
strings pointing in the same direction, as in earlier 2D simulations. We find,
however, that strings belonging to the same bundle do not stay together in 3D
for much longer than the correlation length. As the initial flux per
correlation length is decreased, there is a point at which infinite strings
disappear, as in the Hagedorn transition.
