[R] Generating Random Numbers

Kjetil Halvorsen kjetilbrinchmannhalvorsen at gmail.com
Thu Jul 19 18:27:08 CEST 2012


Those restrictions you have given do not define a unique distribution!
so you need to think better
about what you need.  For instance, if you want a uniform distribution
between min and max with n=5
independent observations from that, but conditional upon sum=total.
For that, you could use rejection sampling, but would be
phenomenally ineffective ...
Kjetil

On Thu, Jul 19, 2012 at 7:12 AM, arunkumar1111 <akpbond007 at gmail.com> wrote:
> hi
>
> My inputs is min=(10,10,10,10,10) and max=(100,100,100,100,100)
> total = 300
> i have to generate 5 numbers between min and max and those numbers should
> sum upto total
>
> Can anyone help?
>
> -----
> Thanks in Advance
>         Arun
> --
> View this message in context: http://r.789695.n4.nabble.com/Generating-Random-Numbers-tp4637020.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



More information about the R-help mailing list