Random vortex method for three dimensional flows. Part I: Mathematical background