--- myst: substitutions: bloc: stocha: python: 6-12 cpp: 5-11 trunc: python: "14" cpp: "13" --- ```{include} /../core/dataserver/attribute/introducing_tstochastic_attribute/gamma_equation.md ``` {{ uranie }} code to simulate a Gamma random variable is: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/attribute/" + language + "/gamma." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc["stocha"][language] + "\n" + "```" }} ```{include} /../core/dataserver/attribute/introducing_tstochastic_attribute/gamma_figure.md ``` Is it also possible to set boundaries to the infinite span of this distribution to create a truncated Gamma law. This can be done by calling the following method: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/dataserver/attribute/" + language + "/gamma." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc["trunc"][language] + "\n" + "```" }} The resulting PDF, CDF and inverse CDF, with and without truncation, can be seen, in this case, in {numref}`dataserver_tgamma_trunc_distribution` for a given set of parameters and various boundaries. {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/dataserver/attribute/python/TGammaTruncatedDistribution.png\n" ":align: center\n" ":name: dataserver_tgamma_trunc_distribution\n" + figure_scale + "\n" "\n" "Example of PDF, CDF and inverse CDF for a Gamma truncated distribution.\n" "```" }}