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

#include <G4INCLRanecu.hh>

+ Inheritance diagram for G4INCL::Ranecu:

Public Member Functions

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

Detailed Description

Definition at line 53 of file G4INCLRanecu.hh.

Constructor & Destructor Documentation

◆ Ranecu() [1/2]

G4INCL::Ranecu::Ranecu ( )

Definition at line 50 of file G4INCLRanecu.cc.

50 {
51 iseed1 = 666;
52 iseed2 = 777;
53 }

◆ Ranecu() [2/2]

G4INCL::Ranecu::Ranecu ( const SeedVector sv)

Definition at line 55 of file G4INCLRanecu.cc.

55 {
56 setSeeds(sv);
57 }
void setSeeds(const SeedVector &sv)
Definition: G4INCLRanecu.hh:66

◆ ~Ranecu()

G4INCL::Ranecu::~Ranecu ( )
virtual

Definition at line 59 of file G4INCLRanecu.cc.

59{}

Member Function Documentation

◆ flat()

G4double G4INCL::Ranecu::flat ( )
virtual

Implements G4INCL::IRandomGenerator.

Definition at line 61 of file G4INCLRanecu.cc.

62 {
63 // This is an adapted version of subroutine ranecu:
64 // A. Padal, J. Sempau Computer Physics Cummunications 175 (2006) 440-450
65 G4double uscale=1.0/2.147483563e9;
66
67 long i1=iseed1/53668;
68 iseed1=40014*(iseed1-i1*53668)-i1*12211;
69
70 if(iseed1 < 0) iseed1 = iseed1 + 2147483563;
71
72 long i2=iseed2/52774;
73 iseed2=40692*(iseed2-i2*52774)-i2*3791;
74 if(iseed2 < 0) iseed2=iseed2+2147483399;
75
76 long iz=iseed1-iseed2;
77 if(iz < 1) iz=iz+2147483562;
78
79 return iz*uscale;
80 }
double G4double
Definition: G4Types.hh:64

◆ getSeeds()

SeedVector G4INCL::Ranecu::getSeeds ( ) const
inlinevirtual

Implements G4INCL::IRandomGenerator.

Definition at line 59 of file G4INCLRanecu.hh.

59 {
60 SeedVector sv;
61 sv.push_back(iseed1);
62 sv.push_back(iseed2);
63 return sv;
64 };
std::vector< long > SeedVector

◆ setSeeds()

void G4INCL::Ranecu::setSeeds ( const SeedVector sv)
inlinevirtual

Implements G4INCL::IRandomGenerator.

Definition at line 66 of file G4INCLRanecu.hh.

66 {
67 iseed1 = sv[0];
68 iseed2 = sv[1];
69 };

Referenced by Ranecu().


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