A computational procedure for the approximation of random functions