22 #include "CLHEP/Random/defs.h"
23 #include "CLHEP/Random/RandStudentT.h"
24 #include "CLHEP/Random/DoubConv.hh"
36 return fire( defaultA );
72 if(
a < 0.0)
return (DBL_MAX);
79 while ((w = u * u + v * v) > 1.0);
81 return(u * std::sqrt(
a * ( std::exp(- 2.0 /
a * std::log(w)) - 1.0) / w));
87 for(
double* v = vect; v != vect + size; ++v )
92 const int size,
double* vect,
95 for(
double* v = vect; v != vect + size; ++v )
105 u = 2.0 * localEngine->flat() - 1.0;
106 v = 2.0 * localEngine->flat() - 1.0;
108 while ((w = u * u + v * v) > 1.0);
110 return(u * std::sqrt(
a * ( std::exp(- 2.0 /
a * std::log(w)) - 1.0) / w));
115 for(
double* v = vect; v != vect + size; ++v )
122 for(
double* v = vect; v != vect + size; ++v )
132 u = 2.0 * anEngine->
flat() - 1.0;
133 v = 2.0 * anEngine->
flat() - 1.0;
135 while ((w = u * u + v * v) > 1.0);
137 return(u * std::sqrt(
a * ( std::exp(- 2.0 /
a * std::log(w)) - 1.0) / w));
141 int pr=os.precision(20);
142 std::vector<unsigned long> t(2);
143 os <<
" " <<
name() <<
"\n";
144 os <<
"Uvec" <<
"\n";
146 os << defaultA <<
" " << t[0] <<
" " << t[1] <<
"\n";
150 int pr=os.precision(20);
151 os <<
" " <<
name() <<
"\n";
152 os << defaultA <<
"\n";
161 if (inName !=
name()) {
162 is.clear(std::ios::badbit | is.rdstate());
163 std::cerr <<
"Mismatch when expecting to read state of a "
164 <<
name() <<
" distribution\n"
165 <<
"Name found was " << inName
166 <<
"\nistream is left in the badbit state\n";
170 std::vector<unsigned long> t(2);
static double longs2double(const std::vector< unsigned long > &v)
static std::vector< unsigned long > dto2longs(double d)
static HepRandomEngine * getTheEngine()
static void shootArray(const int size, double *vect, double a=1.0)
void fireArray(const int size, double *vect)
HepRandomEngine & engine()
std::istream & get(std::istream &is)
std::ostream & put(std::ostream &os) const
bool possibleKeywordInput(IS &is, const std::string &key, T &t)