Dear experts,
I would like to be able to use the same random generator instance both for TF1::GetRandom
and for some builtin distributions, like Random::LogNormal
.
Currently, I can do:
delete gRandom;
gRandom = new TRandomMixMax; // to be used by TF1 and TH1
ROOT::Math::RandomMixMax rmx; // to be used for rmx.LogNormal and other builtin distributions
If I use both methods at the same time to draw from different distributions, then the n-th random number from gRandom
and rmx
will be the same (using the default seed).
Both RandomMixMax
and TRandomMixMax
internally use ROOT::Math::MixMaxEngine
to generate random numbers, but while RandomMixMax
exposes the various builtin distributions, TRandomMixMax
has a more limited choice of distributions.
In particular, the member TRandomMixMax::fEngine
is not publicly accessible, and so the builtin distributions defined in ROOT::Math::MixMaxEngine
are not available in gRandom
.
Is there an easy way to use RandomMixMax
to generate random numbers from user-defined distributions, without having to copy the code of TF1::GetRandom
?
Are there plans to add a method like Engine &GetEngine() { return fEngine; }
to TRandomMixMax
(well, actually TRandomGen
)?
Best,
Claudio
ROOT Version: 6.20
Platform: Ubuntu 16.04
Compiler: gcc