lundi 12 juillet 2021

Sample two random variables uniformly, in region where sum is greater than zero

I am trying to figure out how to sample for two random variables uniformly in the region where the sum of the two is greater than zero. I thought a solution might be to sample for X~U(-1,1) and then sample for Y~U(-x,1) where x would be the current sample for X.

But this resulted in a distribution that looks like this.

This doesn't look uniformly distributed as the density of points at the top left is higher and keeps reducing as we move to the right. Can someone point out where the flaw in my reasoning is and how to possibly fix this?

Thank you




Aucun commentaire:

Enregistrer un commentaire