CbmRoot
Loading...
Searching...
No Matches
CaAlgoRandom.cxx
Go to the documentation of this file.
1/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
10#include "CaAlgoRandom.h"
11
13
14
15// ---------------------------------------------------------------------------------------------------------------------
16//
18
19// ---------------------------------------------------------------------------------------------------------------------
20//
21Random::Random(int seed) { this->SetSeed(seed); }
22
23// ---------------------------------------------------------------------------------------------------------------------
24//
25void Random::SetSeed(int seed)
26{
27 if (seed) {
28 fSeed = seed;
29 }
30 else {
31 std::random_device rd;
32 unsigned int randomDeviceSeed = rd();
33 fSeed = randomDeviceSeed;
34 }
35 fGenerator.seed(fSeed);
36}
Random generator utility class for CA tracking.
A class, providing ROOT-free access to randomly generated variables.
GeneratorType_t fGenerator
Random number generator.
unsigned int fSeed
Random number seed.
Random()
Default constructor.
void SetSeed(int seed)
Sets seed to the random generator.