I would like to generate random values of some parameter with the weight being the Poisson distribution. An important point is that each time I generate the random number I need to consider the distribution with different 1st momentum, that I parametrize by $\gamma$:
$$ f_{\gamma}(x) = \frac{1}{2\gamma}\exp\left[-\frac{x}{2\gamma}\right] $$
I make a grid with 100000 values of $\gamma$, but then find that the procedure of generating the random values is extremely slow, requiring $\mathcal{O}(10^{3})$ s on my machine. How can I speed up the code?
My code is given below:
dist[gamma_] :=
ProbabilityDistribution[
Exp[-(x/(2*gamma))] 1/(2*gamma), {x, 0, Infinity}];
Tabgamma = Table[RandomReal[{1, 100}], {i, 1, 10^5, 1}];
TabRV = Table[RandomVariate[dist[Tabgamma[[i]]]], {i, 1, 10, 1}] //
AbsoluteTiming
(*{0.111845, {38.0185, 162.312, 396.125, 53.1418, 81.3972, 4.29874, 37.5393, 27.0455, 15.5522, 28.2158}}*)