dimanche 31 janvier 2021

Generating random numbers from two different intervals in R

To generate randomly distributed values in a single range, I use:

runif(number_of_numbers, lower_bound, upper_bound)

However, what if I want to generate randomly distributed values in two different intervals?

For example, I want to generate 100 random values between [-3,-2] and [2,3].
Is there an one-line elegant solution for that?




Aucun commentaire:

Enregistrer un commentaire