Will generate numbers from a random subrange within the given range. For example, if [min, max]is set to \[0, 10\], this function could decide to generaten` numbers between 2 and 6.

runif_subrange(n, min, max)

Arguments

n

Number of observations

min

Lower limits of the distribution.

max

Upper limits of the distribution.

Value

Generates values with runif, bounded by a range drawn from sort(runif(2, min, max)).

Examples

runif_subrange(20, 0, 10)
#>  [1] 5.811355 4.001068 4.796214 4.281249 7.410423 4.198423 7.448691 5.221810
#>  [9] 4.074369 6.150147 5.153287 4.478359 4.704797 7.375400 4.649427 7.278821
#> [17] 7.329946 5.253958 5.717144 3.843790