# Mathematica cannot generate the random variables for a given Probability Distribution

I need to generate a large number of random variables from the distribution generated by the following code. Distribution is given by DistributionF. The code is getting stuck at the the execution of the command RandomVariate[DistributionF,1000]. It does not output the R.V.s. How can I resolve this issue.

A = 1/2;
k = 1; τ = 1;
m = 1; β = .6931; σ = 1.8421;

W = {0.0000, 0.0013, 0.0339, 0.2401, 0.6109, 0.6109, 0.2401, 0.0339,
0.0013, 0.0000};

T = {3.4362, 2.5327, 1.7567, 1.0366,
0.3429, -0.3429, -1.0366, -1.7567, -2.5327, -3.4362};

G[t_] := Exp[-Exp[-Sqrt[2]*σ*t - β]*m*
x^2]*(Exp[Sqrt[2]*σ*t + β])^(-m);

f[x_] = (1 - A)*
FullSimplify[
2*(1 + k)*x/τ*Exp[-k - (1 + k)*x^2/τ]*
BesselJ[0, 2*Sqrt[k*(1 + k)/τ]*x]] +
A*(x^(2*m - 1)*2*m^m)/(Sqrt[π]*Gamma[m])*W.(G /@ T);

DistributionF = TransformedDistribution[x^2,
x \[Distributed] ProbabilityDistribution[f[x], {x, 0, Infinity}]];

RandomVariate[DistributionF,1000]

• If f[x] is a PDF then NIntegrate[f[x], {x, 0, ∞}] should return 1 since you have defined {0, ∞} as the domain of f. However, it returns 0.567652. – Edmund Feb 8 '17 at 4:14
• @Edmund - The Method option can handle this. ProbabilityDistribution[f[x], {x, 0, Infinity}, Method -> "Normalize"] – Bob Hanlon Feb 8 '17 at 4:18
• @BobHanlon Nice! I did not notice that before. Still taking forever to evaluate for just 1 sample. – Edmund Feb 8 '17 at 4:22
• Works for me, 10.x on Windows... – ciao Feb 8 '17 at 4:41
• @ciao, I have been using 11.01 on Mac.. – George Harnandez Feb 8 '17 at 4:49