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] 8.928677 9.218828 8.596605 9.088927 9.221875 8.878813 8.491093 8.887848 #> [9] 8.632771 9.528490 9.343999 9.265636 8.791238 8.592299 8.985922 9.501343 #> [17] 8.629301 9.371101 8.803490 8.813048