Spin-transfer torque magnetic memory as a stochastic memristive synapse for neuromorphic systems