I suggest you put in arguments for R functions, see sampleBeta