Random gradient extrapolation for distributed and stochastic optimization