forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathRandomNumbers.cpp
More file actions
28 lines (21 loc) · 932 Bytes
/
RandomNumbers.cpp
File metadata and controls
28 lines (21 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// This file is part of the ACTS project.
//
// Copyright (C) 2016 CERN for the benefit of the ACTS project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#include "ActsExamples/Framework/RandomNumbers.hpp"
#include "Acts/Utilities/HashCombine.hpp"
#include "ActsExamples/Framework/AlgorithmContext.hpp"
namespace ActsExamples {
RandomNumbers::RandomNumbers(const Config& cfg) : m_cfg(cfg) {}
RandomEngine RandomNumbers::spawnGenerator(
const AlgorithmContext& context) const {
return RandomEngine(generateSeed(context));
}
RandomSeed RandomNumbers::generateSeed(const AlgorithmContext& context) const {
return Acts::hashMixAndCombine(m_cfg.seed, context.eventNumber,
context.algorithmNumber);
}
} // namespace ActsExamples