# Difference between two usages of TransformedDistribution

I am modeling the distribution of the sum of two dice throws as a TransformedDistribution

d1 = TransformedDistribution[x + y, {x, y}\[Distributed]DiscreteUniformDistribution[{1, 6}]]


and wanted to take random samples with

(* In[2] = *)
RandomVariate[d1]

(* Out[2] = RandomVariate[
TransformedDistribution[\[FormalX]1 + \FormalX]2,
{\[FormalX]1, \[FormalX]2} \[Distributed] DiscreteUniformDistribution[{1, 6}]
]
]*)


but instead of a sample i get the unevaluated expression back. If i define my distribution like this

d2 = TransformedDistribution[x + y,
{x \[Distributed] DiscreteUniformDistribution[{1, 6}],
y \[Distributed] DiscreteUniformDistribution[{1, 6}]}
]


(* In[3] = *)
RandomVariate[d2]

(* Out[3] = 7 *)


Can someone explain where this difference in behaviour comes from and if it's intended or should behave the same?

• d1 as you have defined does not evaluate as the distribution is univariate and you are asking it to be bivariate, You could use TransformedDistribution[ x + y, {x, y} \[Distributed] DiscreteUniformDistribution[{{1, 6}, {1, 6}}]] Commented Apr 8, 2016 at 11:50
• oh, i see, thanks for the explanation! If you put this as an answer i would accept it! Thanks! Commented Apr 8, 2016 at 12:27
• I don't think you will beat the simplicity of: RandomInteger[{1, 6}] + RandomInteger[{1, 6}] by using RandomVariate[ TransformedBlah ] ... especially if you need just one drawing at a time (rather than a million in advance). Commented Apr 8, 2016 at 15:00

TransformedDistribution[ x + y, {x, y} \[Distributed] DiscreteUniformDistribution[{{1, 6}, {1, 6}}]]