Random generation is done using the algorithm described by Michael, Schucany and Haas (1976).
Examples
x <- rwald(1e5,5,16)hist(x,100, freq =FALSE)curve(dwald(x,5,16),0,50, col ="red", add =TRUE)hist(pwald(x,5,16))plot(ecdf(x))curve(pwald(x,5,16),0,50, col ="red", lwd =2, add =TRUE)
References
Michael, J.R., Schucany, W.R., and Haas, R.W. (1976). Generating Random Variates Using Transformations with Multiple Roots. The American Statistician, 30(2): 88-90.