  We perform two-dimensional relativistic magnetohydrodynamic simulations of a
mildly relativistic shock propagating through an inhomogeneous medium. We show
that the postshock region becomes turbulent owing to preshock density
inhomogeneity, and the magnetic field is strongly amplified due to the
stretching and folding of field lines in the turbulent velocity field. The
amplified magnetic field evolves into a filamentary structure in
two-dimensional simulations. The magnetic energy spectrum is flatter than the
Kolmogorov spectrum and indicates that a so-called small-scale dynamo is
occurring in the postshock region. We also find that the amount of
magnetic-field amplification depends on the direction of the mean preshock
magnetic field, and the time scale of magnetic-field growth depends on the
shock strength.
