Re: [R] generate random numbers subject to constraints

From: Alberto Monteiro <>
Date: Wed, 26 Mar 2008 19:36:00 -0200

Ala' Jaouni wrote:


> I am trying to generate a set of random numbers that fulfill the
> following constraints:
> X1 + X2 + X3 + X4 = 1
> aX1 + bX2 + cX3 + dX4 = n
> where a, b, c, d, and n are known.
> Any function to do this?
You must give more information.

How are those numbers distributed? Are they normal? Positive?

If they can be anything, just generate X1, X2 and then compute X3, X4.

Alberto Monteiro mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 26 Mar 2008 - 21:51:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 26 Mar 2008 - 22:30:26 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive