69 InterpolationType(IntType)
75 const double* aProbFunc,
81 InterpolationType(IntType)
87 const double* aProbFunc,
91 localEngine(anEngine),
93 InterpolationType(IntType)
104 "RandGeneral constructed with no bins - will use flat distribution\n";
114 for ( ptn = 0; ptn<
nBins; ++ptn ) {
115 weight = aProbFunc[ptn];
120 "RandGeneral constructed with negative-weight bin " << ptn <<
121 " = " << weight <<
" \n -- will substitute 0 weight \n";
130 "RandGeneral constructed nothing in bins - will use flat distribution\n";
135 for ( ptn = 0; ptn < nBins+1; ++ptn ) {
148 <<
"\n Will use type 0 (continuous linear interpolation \n";
149 InterpolationType = 0;
189 while (nabove > nbelow+1) {
190 middle = (nabove + nbelow+1)>>1;
197 assert ( nabove == nbelow+1 );
213 if ( binMeasure == 0 ) {
220 double binFraction = (rand - theIntegralPdf[nbelow]) / binMeasure;
228 const int size,
double* vect )
232 for (i=0; i<size; ++i) {
233 vect[i] =
shoot(anEngine);
241 for (i=0; i<size; ++i) {
247 int pr=os.precision(20);
248 std::vector<unsigned long>
t(2);
249 os <<
" " <<
name() <<
"\n";
250 os <<
"Uvec" <<
"\n";
253 os << t[0] <<
" " << t[1] <<
"\n";
266 if (inName !=
name()) {
267 is.clear(std::ios::badbit | is.rdstate());
268 std::cerr <<
"Mismatch when expecting to read state of a "
269 <<
name() <<
" distribution\n"
270 <<
"Name found was " << inName
271 <<
"\nistream is left in the badbit state\n";
275 std::vector<unsigned long>
t(2);