Herein, we present simulations of conductive filament formation in resistive random-access memory using a finite element solver. We consider the switching material, which is typically an oxide, as a two-phase material comprising low- and high-resistance phases. The low-resistance phase corresponds to a defective and conducting region with a high anion vacancy concentration, whereas the high-resistance phase corresponds to a non-defective and insulating region with a low anion-vacancy concentration. We adopt a phase variable corresponding to 0 and 1 in the insulating and conducting phases, respectively, and we change the phase variable suitably when new defects are introduced during voltage ramp-up for forming. Initially, some defects are embedded in the switching material. When the applied voltage is ramped up, the phase variable changes from 0 to 1 at locations wherein the electric field exceeds a critical value, which corresponds to the introduction of new defects via vacancy generation. The applied voltage at which the defects percolate to form a filament is considered as the forming voltage. Here, we study the forming-voltage uniformity using simulations, and we find that for typical planar-electrode devices, the forming voltage varies significantly owing to the stochastic location of the initial defects at which the electric field is "crowded." On the other hand, a protruding electrode can improve the switching uniformity drastically via facilitating the deterministic location of electric-field crowding, which also supported by the reported experimental results.