We study the localization property of a two-dimensional noninteracting electron gas in the presence of a random magnetic field. The localization length is directly calculated using a transfer matrix technique and finite size scaling analysis. We show strong numerical evidence that the system undergoes a disorder-driven Kosterlitz-Thouless-type metal-insulator transition. We develop a mean field theory which maps the random field system into a two-dimensional XY model. The vortex and antivortex excitations in the XY model correspond to two different kinds of magnetic domains in the random field system. [ S0031-9007(98) There has been a long lasting interest in understanding the localization problem in two-dimensional (2D) systems. According to the scaling theory of localization [1], all states in a 2D system are localized if only scalar random potential is present. However, in the presence of a strong perpendicular magnetic field, where the time reversal symmetry is broken, extended states appear in the center of disorder-broadened Landau bands and give rise to the integer quantum Hall effect (QHE) [2].Recently, Halperin, Lee, and Read [3] and Kalmeyer and Zhang [4] developed an effective Chern-Simons field theory to understand electronic properties of the fractional QHE systems. In their theory the quasiparticles are weakly interacting composite fermions [5] which can be constructed by attaching an even number of flux quanta to electrons under a Chern-Simons transformation. In this simple picture, the fractional QHE can be mapped into the integer QHE for the composite fermion system subject to an effective magnetic field [5]. At the filling factor n f 1 2 , although the effective magnetic field B ء vanishes, composite fermions are subject to the random fluctuations of the gauge field induced by the ordinary impurities [3,4]. Thus, it is important to study the localization properties of noninteracting charged particles in the presence of a random magnetic field to understand the half-filling system. The problem of charged particles moving in a random magnetic field is also relevant to the theoretical studies of high T c models where the gauge field fluctuations play an important role [6].There have been many studies trying to understand the localization problem of noninteracting particles in a random magnetic field with zero mean [7][8][9][10][11][12][13][14][15][16][17][18]. However, the main issue, namely, whether there is metal-insulator transition (MIT), remains controversial. Conclusions from previous numerical studies can be summarized into the following three classes: (i) There exists a MIT with scaling behavior on both metal and insulator sides [15,18], (ii) there exists a MIT; however, the scaling curve is found only on the insulator side [7,8,13], and (iii) all states are localized [9,10]. On the analytic side, the result is also inconclusive. According to the conventional scaling theory of localization, the random flux system belongs to the unitary ensemble, which is described by a nonlinear sigma mo...