A stochastic description of a spin-1/2 particle in a magnetic field