Re: [R] random value generation with added constraint.

2011-08-05 Thread Tóth Zoltán
Hi, If I understand correctly, you can just simply keep generating norm values till you don't get the 100 appropriate one. I am pretty new to R, but here you go with a function that does this: rnorm25 <- function(mean,sd,X){ i = 0; ret = c() while ( i < 100 ){ r = rnorm(1,mean,sd)

Re: [R] random value generation with added constraint.

2011-08-04 Thread Duncan Murdoch
On 04/08/2011 12:03 PM, Vijayan Padmanabhan wrote: Hi I am looking at generating a random dataset of say 100 values fitting in a normal distribution of a given mean and SD, I am aware of rnorm function. However i am trying to build into this function one added constraint that all the random value