Skip to content
Prev 169882 / 398506 Next

Choosing a random number between x and y

On Mon, 2009-02-09 at 06:40 -0800, Vie wrote:
Hi Vie 

I don't understand if you need a only random generation or mixture
random generation, so i will make the 3 examples Using runif

1- Random 10 number Retween 0 and 0.5 runif(10,0,0.5)

2 -Random 20 number Retween 0 and 0.7 runif(20,0,0.7)

3- Random 40 number of mixture two random uniforme random 1 and 2 with
p(random1)= 0.3 and p(random=2) = 0.7

ifelse(runif(40)>.3,runif(40,0,0.7),runif(40,0,0.5))