Solved – Sample from continuous uniform distribution with open interval

If I want to sample from a continuous uniform distribution with interval $(a,b]$, how can I do it in R? Or is it just the same as sampling from $(a,b)$ in R using

runif(1,min = a, max = b) 

?

As shown in the R Documentation: runif will not generate either of the extreme values unless max = min or max-min is small compared to min, and in particular not for the default arguments. So generally you don't have to worry about that.

Similar Posts:

Rate this post

Leave a Comment