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] 1.558032 2.363559 1.991581 2.388195 2.032157 1.474271 2.102645 2.028571 #> [9] 1.434369 1.650526 1.548018 1.777840 2.320207 1.351839 2.212482 1.365830 #> [17] 1.493035 1.437356 1.832162 2.212970