1
I need to define randomly the weight of an investment portfolio that is divided into three types and cm the following limitations:
- Fixed income [0-100%]
- Variable Income [0-30%]
- Investment abroad 0-10%]
Restrictions:
- All investments must be greater than or equal to 0;
- And the sum of the weights should be 1 + 2 + 3 = 100%.
Generating the numbers separately is not the problem and obeying the first constraint is easy, but I cannot do the second.
rendaFixa <- runif(1, 0, 1)
rendaVariavel <- runif(1, 0, 0.3)
rendaIE <- runif(1, 0, 0.1)