Sure. One possibility is a random number generator inside the function. MATLAB to generate a random number between 1-10: fix(rand(1)*10+1);