A PAC-Bayesian Analysis of Randomized Learning with Application to Stochastic Gradient Descent