Geant4-11
Public Member Functions | Private Attributes
G4INCL::Ranecu3 Class Reference

Extended Ranecu-type RNG class. More...

#include <G4INCLRanecu3.hh>

Inheritance diagram for G4INCL::Ranecu3:
G4INCL::IRandomGenerator

Public Member Functions

G4double flat ()
 
Random::SeedVector getSeeds ()
 
 Ranecu3 ()
 
 Ranecu3 (const Random::SeedVector &sv)
 
void setSeeds (const Random::SeedVector &sv)
 
virtual ~Ranecu3 ()
 

Private Attributes

const G4int a1
 
const G4int a2
 
const G4int a3
 
G4int i1
 
G4int i2
 
G4int i3
 
G4int iseed1
 
G4int iseed2
 
G4int iseed3
 
G4int iz
 
const G4int m1
 
const G4int m2
 
const G4int m3
 
const G4int q1
 
const G4int q2
 
const G4int q3
 
const G4int r1
 
const G4int r2
 
const G4int r3
 
const G4double uscale
 

Detailed Description

Extended Ranecu-type RNG class.

This generator implements the C++ version of the generator suggested by Badal and Sempau, Comp. Phys. Comm. 175 (2006) 440. It uses three 32-bit seeds and has a period of ~5E27.

Definition at line 59 of file G4INCLRanecu3.hh.

Constructor & Destructor Documentation

◆ Ranecu3() [1/2]

G4INCL::Ranecu3::Ranecu3 ( )

Definition at line 49 of file G4INCLRanecu3.cc.

49 :
50 iseed1(666),
51 iseed2(777),
52 iseed3(1234),
53 i1(0), i2(0), i3(0), iz(0),
54 uscale(1.0/2.147483563e9),
55 m1(2147483563), m2(2147483399), m3(2147482739),
56 a1(40014), a2(40692), a3(45742),
57 q1(m1/a1), q2(m2/a2), q3(m3/a3),
58 r1(m1%a1), r2(m2%a2), r3(m3%a3)
59 {
60 }
const G4int r1
const G4int m1
const G4int a1
const G4int a3
const G4int a2
const G4int q1
const G4int m2
const G4int m3
const G4int r2
const G4int q3
const G4int q2
const G4double uscale
const G4int r3

◆ Ranecu3() [2/2]

G4INCL::Ranecu3::Ranecu3 ( const Random::SeedVector sv)

Definition at line 62 of file G4INCLRanecu3.cc.

62 :
63 i1(0), i2(0), i3(0), iz(0),
64 uscale(1.0/2.147483563e9),
65 m1(2147483563), m2(2147483399), m3(2147482739),
66 a1(53668), a2(52774), a3(46947),
67 q1(m1/a1), q2(m2/a2), q3(m3/a3),
68 r1(m1%a1), r2(m2%a2), r3(m3%a3)
69 {
70 setSeeds(sv);
71 }
void setSeeds(const Random::SeedVector &sv)

References setSeeds().

◆ ~Ranecu3()

G4INCL::Ranecu3::~Ranecu3 ( )
virtual

Definition at line 73 of file G4INCLRanecu3.cc.

73{}

Member Function Documentation

◆ flat()

G4double G4INCL::Ranecu3::flat ( )
virtual

Implements G4INCL::IRandomGenerator.

Definition at line 75 of file G4INCLRanecu3.cc.

76 {
77 i1=iseed1/q1;
79 if(iseed1 < 0) iseed1 = iseed1 + m1;
80
81 i2=iseed2/q2;
83 if(iseed2 < 0) iseed2 = iseed2 + m2;
84
85 i3=iseed3/q3;
87 if(iseed3 < 0) iseed3 = iseed3 + m3;
88
89 iz = iseed1 - iseed2 + iseed3;
90 if(iz < 1) iz = iz + 2147483562;
91
92 return iz*uscale;
93 }

References a1, a2, a3, i1, i2, i3, iseed1, iseed2, iseed3, iz, m1, m2, m3, q1, q2, q3, r1, r2, r3, and uscale.

◆ getSeeds()

Random::SeedVector G4INCL::Ranecu3::getSeeds ( )
inlinevirtual

Implements G4INCL::IRandomGenerator.

Definition at line 65 of file G4INCLRanecu3.hh.

65 {
66 Random::SeedVector sv;
67 sv.push_back(iseed1);
68 sv.push_back(iseed2);
69 sv.push_back(iseed3);
70 return sv;
71 }

References iseed1, iseed2, and iseed3.

◆ setSeeds()

void G4INCL::Ranecu3::setSeeds ( const Random::SeedVector sv)
inlinevirtual

Implements G4INCL::IRandomGenerator.

Definition at line 73 of file G4INCLRanecu3.hh.

73 {
74// assert(sv.size()>=3);
75 iseed1 = sv[0];
76 iseed2 = sv[1];
77 iseed3 = sv[2];
78 }

References iseed1, iseed2, and iseed3.

Referenced by Ranecu3().

Field Documentation

◆ a1

const G4int G4INCL::Ranecu3::a1
private

Definition at line 87 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ a2

const G4int G4INCL::Ranecu3::a2
private

Definition at line 87 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ a3

const G4int G4INCL::Ranecu3::a3
private

Definition at line 87 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ i1

G4int G4INCL::Ranecu3::i1
private

Definition at line 84 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ i2

G4int G4INCL::Ranecu3::i2
private

Definition at line 84 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ i3

G4int G4INCL::Ranecu3::i3
private

Definition at line 84 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ iseed1

G4int G4INCL::Ranecu3::iseed1
private

Definition at line 83 of file G4INCLRanecu3.hh.

Referenced by flat(), getSeeds(), and setSeeds().

◆ iseed2

G4int G4INCL::Ranecu3::iseed2
private

Definition at line 83 of file G4INCLRanecu3.hh.

Referenced by flat(), getSeeds(), and setSeeds().

◆ iseed3

G4int G4INCL::Ranecu3::iseed3
private

Definition at line 83 of file G4INCLRanecu3.hh.

Referenced by flat(), getSeeds(), and setSeeds().

◆ iz

G4int G4INCL::Ranecu3::iz
private

Definition at line 84 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ m1

const G4int G4INCL::Ranecu3::m1
private

Definition at line 86 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ m2

const G4int G4INCL::Ranecu3::m2
private

Definition at line 86 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ m3

const G4int G4INCL::Ranecu3::m3
private

Definition at line 86 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ q1

const G4int G4INCL::Ranecu3::q1
private

Definition at line 88 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ q2

const G4int G4INCL::Ranecu3::q2
private

Definition at line 88 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ q3

const G4int G4INCL::Ranecu3::q3
private

Definition at line 88 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ r1

const G4int G4INCL::Ranecu3::r1
private

Definition at line 89 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ r2

const G4int G4INCL::Ranecu3::r2
private

Definition at line 89 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ r3

const G4int G4INCL::Ranecu3::r3
private

Definition at line 89 of file G4INCLRanecu3.hh.

Referenced by flat().

◆ uscale

const G4double G4INCL::Ranecu3::uscale
private

Definition at line 85 of file G4INCLRanecu3.hh.

Referenced by flat().


The documentation for this class was generated from the following files: