Quantum mechanics derived from stochastic electrodynamics