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) `

?

**Contents**hide

#### Best Answer

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:

- Solved – How to manually make a qq plot of p-value against uniform distribution
- Solved – How to manually make a qq plot of p-value against uniform distribution
- Solved – Can we really sample from a Continuous distribution (Scipy function) and what does it mean
- Solved – Can we really sample from a Continuous distribution (Scipy function) and what does it mean
- Solved – What would the calculated value of the standard deviation of a uniform distribution be