Stochastic transformations and functional equations