00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "RandFlat.h"
00032
00033 const HepInt RandFlat::MSBBits= 15;
00034 const unsigned long RandFlat::MSB= 1ul<<RandFlat::MSBBits;
00035 unsigned long RandFlat::staticRandomInt= 0;
00036 unsigned long RandFlat::staticFirstUnusedBit= 0;
00037
00038 RandFlat::~RandFlat() {
00039 if ( deleteEngine ) delete localEngine;
00040 }
00041
00042 HepDouble RandFlat::operator()() {
00043 return fire();
00044 }
00045
00046 void RandFlat::shootArray( const HepInt size, HepDouble* vect,
00047 HepDouble lx, HepDouble dx )
00048 {
00049 register HepInt i;
00050
00051 for (i=0; i<size; ++i)
00052 vect[i] = shoot(lx,dx);
00053 }
00054
00055 void
00056 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00057 RandFlat::shootArray( vector<HepDouble>& vec, HepDouble lx, HepDouble dx )
00058 #else
00059 RandFlat::shootArray( vector<HepDouble,allocator<HepDouble> >& vec, HepDouble lx, HepDouble dx )
00060 #endif
00061 {
00062 for (unsigned int i=0; i<vec.size(); ++i)
00063 vec[i] = shoot(lx,dx);
00064 }
00065
00066 void RandFlat::shootArray( HepRandomEngine* anEngine,
00067 const HepInt size, HepDouble* vect,
00068 HepDouble lx, HepDouble dx )
00069 {
00070 for (int i=0; i<size; ++i)
00071 vect[i] = shoot(anEngine,lx,dx);
00072 }
00073
00074
00075 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00076 void RandFlat::shootArray( HepRandomEngine* anEngine,
00077 vector<HepDouble>& vec,
00078 HepDouble lx, HepDouble dx )
00079 #else
00080 void RandFlat::shootArray( HepRandomEngine* anEngine,
00081 vector<HepDouble,allocator<HepDouble> >& vec,
00082 HepDouble lx, HepDouble dx )
00083 #endif
00084 {
00085 for (unsigned int i=0; i<vec.size(); ++i)
00086 vec[i] = shoot(anEngine,lx,dx);
00087 }
00088
00089 void RandFlat::fireArray( const HepInt size, HepDouble* vect,
00090 HepDouble lx, HepDouble dx )
00091 {
00092 register HepInt i;
00093
00094 for (i=0; i<size; ++i)
00095 vect[i] = fire(lx,dx);
00096 }
00097
00098 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00099 void RandFlat::fireArray( vector<HepDouble>& vec, HepDouble lx, HepDouble dx )
00100 #else
00101 void RandFlat::fireArray( vector<HepDouble,allocator<HepDouble> >& vec, HepDouble lx, HepDouble dx )
00102 #endif
00103 {
00104 for (unsigned int i=0; i<vec.size(); ++i)
00105 vec[i] = fire(lx,dx);
00106 }