Belle II Software  release-08-01-10
TRandomWrapper.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <TRandom.h>
12 
13 namespace Belle2 {
20  struct TRandomWrapper {
21 
23  typedef unsigned int result_type;
24 
26  static constexpr result_type min() { return 0; }
27 
29  static constexpr result_type max() { return std::numeric_limits<result_type>::max(); }
30 
32  result_type operator()() { return gRandom->Integer(max()); }
33  };
34 
36 }
Abstract base class for different kinds of events.
Wrap TRandom to be useable as a uniform random number generator with STL algorithms like std::shuffle...
static constexpr result_type max()
Maximum value returned by the random number generator.
result_type operator()()
Return a random value in the range [min(), max()].
static constexpr result_type min()
Minimum value returned by the random number generator.
unsigned int result_type
Define the result type to be a normal unsigned int.