Development of bioinspired devices for energy-efficient computing requires numerical models that can reproduce the global electrical behavior of neurons. We present herein a stochastic model based on the Monte Carlo technique that can reproduce the steady state and the action potential in neurons in terms of the probabilities for different ions to cross the cell membrane. Gating channels for sodium and potassium cations and leakage channels are taken into account following the Hodgkin-Huxley equations in a first stage. We then expand the model to include the time-dependent ion concentrations in the intra- and extracellular space and the related Nernst potentials, and the existence of ion pumps to equilibrate the steady-state currents. The model allows monitoring of the random passage of ions across a biological membrane, and thus includes the influence of ion shot noise. For small membrane areas, results evidence that, when considered alone, shot noise has a discernible effect on spiking in a wide range of excitation currents, not only by leading to the onset of spikes but also by inhibiting their appearance.