Amazing!
Seems a little hacky using a variable from the parent scope, but it works 
Further, I had to call .eval() on the shared current_epoch in the random() function, as the random function should be using numpy arrays and not theano tensors.