Message-ID: <CACk-te1E9jv-eZMvA19_8SAqsDqqH4zWnr=cbd-=NFzt6evY0w@mail.gmail.com>
Date: 2014-11-22T15:19:03Z
From: Bert Gunter
Subject: Generate random numbers under constrain
In-Reply-To: <CACk-te3cp2FkTJEg_xS8GoaqZR58kcQ0sURrZYZ-DgwYB4pHHA@mail.gmail.com>
(Hit send key by accident before I was finished ...)
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll
On Sat, Nov 22, 2014 at 7:14 AM, Bert Gunter <bgunter at gene.com> wrote:
> Well, if their sum must be < 1 they ain't random...
>
But anyway, one way is ... given n
randnums <- function(n)
{
u <- runif(n)
u/sum(u)
}
Bert Gunter
>
>
> On Sat, Nov 22, 2014 at 6:29 AM, Ragia Ibrahim <ragia11 at hotmail.com> wrote:
>>
>> Dear all,
>> I use R 3.1.1 for Windows.
>> kindly how can I generate n number of random numbers with probability from [0,1]
>> and their sum must not be more than one
>> thanks in advance
>> Ragia
>>
>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.