[R] runif with condition

David Winsemius dwinsemius at comcast.net
Mon Jan 9 17:33:16 CET 2012


On Jan 9, 2012, at 10:27 AM, David Winsemius wrote:

>
> On Jan 9, 2012, at 10:06 AM, arunkumar1111 wrote:
>
>> Hi
>> I want to generate 4 random number which sum up to 100 always
>
> "Random" plus condition == "non-random"

An offlist correspondent has disputed this and I can admit that I was  
perhaps too hasty here. If the sample space is defined, for instance,  
as the set of all positive integers whose sum is 100, then it might be  
possible to say that one randomly drawn instance of such a 4-tuple  
would be "4 random numbers". What I meant to suggest is that the sum- 
to-100-constraint means that once a set of 3 numbers from the  
appropriate sample space have been drawn, that the fourth is no longer  
"random".

>
> Perhaps you want 3 "random" numbers conjoined to the difference of  
> their sum and 100? Or perhaps you want 4 "random" numbers multiplied  
> by 100/sum(.)
>
> (In either case you will not be getting "4 random numbers".)
>
> -- 


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list