Skip to content
Prev 41307 / 398500 Next

generate random number

Please note that "a" is given by "b" (or vice versa), because the 
integral from x1 to x2 of f(x)dx must be 1. 

      I have solved this kind of problem by writing density functions, 
cumulative distribution functions, quantile and random number functions 
as a set of 4, using different ones to help check the others.  If your 
distribution is "ss", then the standard S naming convention would have 
dss, pss, qss, and rss for density, probability (cdf), quantile (inverse 
cdf) and random number generation.  See, e.g., "?runif" for a typical 
argument convention. 

      Note that rss <- function(n, ...)pss(runif(n), ...)

      hope this helps.  spencer graves
Ragnhild S?rum wrote: