Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCL::Ranecu3 Class Reference

Extended Ranecu-type RNG class. More...

#include <G4INCLRanecu3.hh>

+ Inheritance diagram for G4INCL::Ranecu3:

Public Member Functions

 Ranecu3 ()
 
 Ranecu3 (const Random::SeedVector &sv)
 
virtual ~Ranecu3 ()
 
Random::SeedVector getSeeds ()
 
void setSeeds (const Random::SeedVector &sv)
 
G4double flat ()
 
- Public Member Functions inherited from G4INCL::IRandomGenerator
 IRandomGenerator ()
 
virtual ~IRandomGenerator ()
 
virtual Random::SeedVector getSeeds ()=0
 
virtual void setSeeds (const Random::SeedVector &)=0
 
virtual G4double flat ()=0
 

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 }

◆ 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)

◆ ~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;
78 iseed1=a1*(iseed1-i1*q1)-i1*r1;
79 if(iseed1 < 0) iseed1 = iseed1 + m1;
80
81 i2=iseed2/q2;
82 iseed2=a2*(iseed2-i2*q2)-i2*r2;
83 if(iseed2 < 0) iseed2 = iseed2 + m2;
84
85 i3=iseed3/q3;
86 iseed3=a3*(iseed3-i3*q3)-i3*r3;
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 }

◆ 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 }

◆ 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 }

Referenced by Ranecu3().


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