# Sampling uniformly in a triangular support

**URL:** https://discourse.pymc.io/t/sampling-uniformly-in-a-triangular-support/765
**Category:** Questions
**Created:** [January 19, 2018, 9:36pm UTC](https://discourse.pymc.io/t/sampling-uniformly-in-a-triangular-support/765 "2018-01-19T21:36:26Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)
#### Post date: [January 19, 2018, 10:26pm UTC](https://discourse.pymc.io/t/sampling-uniformly-in-a-triangular-support/765/2 "2018-01-19T22:26:49Z")

</div>

There are a couple of ways to do it:

1. You can use the ordered transformation [here](https://discourse.pymc.io/t/mixture-models-and-breaking-class-symmetry/208/5?u=junpenglao).
2. You can add jacobian correction for the volume change in your case above as well to make it proper.
3. You can jointly sample from a bivariate standard Gaussian then rotating them by 45 degrees. The rotated sample is transformed into rates that lie in the unit square. See [here](http://nbviewer.jupyter.org/github/pymc-devs/resources/blob/master/BCM/ModelSelection/ComparingBinomialRates.ipynb#9.2-Order-restricted-equality-of-proportions).
4. You can add a potential to restrict the order, see [here cell [4]](http://docs.pymc.io/notebooks/gaussian_mixture_model.html?highlight=potential) for an example

---

_[View the full topic](https://discourse.pymc.io/t/sampling-uniformly-in-a-triangular-support/765)._
