ROOT
6.07/01
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
math
mathcore
inc
Math
StdRandomEngines.h
Go to the documentation of this file.
1
// @(#)root/mathcore:$Id$
2
// Author: L. Moneta Tue Aug 4 2015
3
4
/**********************************************************************
5
* *
6
* Copyright (c) 2015 LCG ROOT Math Team, CERN/PH-SFT *
7
* *
8
* *
9
**********************************************************************/
10
11
// random engines based on ROOT
12
13
#ifndef ROOT_Math_StdRandomEngines
14
#define ROOT_Math_StdRandomEngines
15
16
#include <random>
17
18
19
namespace
ROOT {
20
21
namespace
Math {
22
23
24
class
StdRandomEngine
{};
25
26
/**
27
Wrapper class for std::random generator to be included in ROOT
28
*/
29
30
template
<
class
Generator>
31
class
StdEngine
{
32
33
34
public
:
35
36
typedef
StdRandomEngine
BaseType
;
37
38
StdEngine
() :
fGen
() { }
39
40
void
SetSeed
(
unsigned
int
seed) {
fGen
.seed(seed);}
41
42
double
Rndm
() {
43
const
double
kCONS = 4.6566128730774E-10;
// (1/pow(2,31)
44
unsigned
int
rndm
=
fGen
();
// generate integer number
45
if
(rndm != 0)
return
kCONS*
rndm
;
46
return
Rndm
();
47
}
48
49
unsigned
int
operator()
() {
50
return
fGen
();
51
}
52
53
private
:
54
Generator
fGen
;
55
};
56
57
58
}
// end namespace Math
59
60
}
// end namespace ROOT
61
62
63
#endif
/* ROOT_Math_TRandomEngines */
ROOT::Math::StdEngine::BaseType
StdRandomEngine BaseType
Definition:
StdRandomEngines.h:36
ROOT::Math::StdEngine::fGen
Generator fGen
Definition:
StdRandomEngines.h:54
ROOT::Math::StdEngine::operator()
unsigned int operator()()
Definition:
StdRandomEngines.h:49
ROOT::Math::StdRandomEngine
Definition:
StdRandomEngines.h:24
ROOT::Math::StdEngine
Wrapper class for std::random generator to be included in ROOT.
Definition:
StdRandomEngines.h:31
ROOT::Math::StdEngine::SetSeed
void SetSeed(unsigned int seed)
Definition:
StdRandomEngines.h:40
ROOT::Math::StdEngine::Rndm
double Rndm()
Definition:
StdRandomEngines.h:42
rndm
TRandom3 rndm
Definition:
fit2dHist.C:44
ROOT::Math::StdEngine::StdEngine
StdEngine()
Definition:
StdRandomEngines.h:38