56 return fire( mean, stdDev );
76 v1 = 2.0 * anEngine->
flat() - 1.0;
77 v2 = 2.0 * anEngine->
flat() - 1.0;
81 fac = std::sqrt(-2.0*std::log(r)/r);
89 double mean,
double stdDev )
91 for(
double*
v = vect;
v != vect + size; ++
v )
109 v1 = 2.0 * anEngine->
flat() - 1.0;
110 v2 = 2.0 * anEngine->
flat() - 1.0;
114 fac = std::sqrt( -2.0*std::log(r)/r);
122 const int size,
double* vect,
123 double mean,
double stdDev )
125 for(
double*
v = vect;
v != vect + size; ++
v )
126 *
v =
shoot(anEngine,mean,stdDev);
148 fac = std::sqrt(-2.0*std::log(r)/r);
157 for(
double*
v = vect;
v != vect + size; ++
v )
162 double mean,
double stdDev )
164 for(
double*
v = vect;
v != vect + size; ++
v )
165 *
v =
fire( mean, stdDev );
198 std::vector<unsigned long>
t(2);
200 outfile <<
"RANDGAUSS CACHED_GAUSSIAN: Uvec "
201 <<
getVal() <<
" " << t[0] <<
" " << t[1] <<
"\n";
203 outfile <<
"RANDGAUSS NO_CACHED_GAUSSIAN: 0 \n" ;
218 char inputword[] =
"NO_KEYWORD ";
222 if (strcmp(inputword,
"RANDGAUSS")==0)
break;
223 if (infile.eof())
break;
231 if (strcmp(inputword,
"RANDGAUSS")==0) {
235 if (strcmp(setword,
"CACHED_GAUSSIAN:") ==0) {
237 std::vector<unsigned long>
t(2);
256 os <<
name() <<
"\n";
257 int prec = os.precision(20);
258 std::vector<unsigned long>
t(2);
261 os <<
defaultMean <<
" " << t[0] <<
" " << t[1] <<
"\n";
266 os <<
"nextGauss " <<
nextGauss <<
" " << t[0] <<
" " << t[1] <<
"\n";
268 os <<
"no_cached_nextGauss \n";
277 if (inName !=
name()) {
278 is.clear(std::ios::badbit | is.rdstate());
279 std::cerr <<
"Mismatch when expecting to read state of a "
280 <<
name() <<
" distribution\n"
281 <<
"Name found was " << inName
282 <<
"\nistream is left in the badbit state\n";
288 std::vector<unsigned long>
t(2);
294 if (ng ==
"nextGauss") {
302 if ( (!is) || (c1 !=
"Mean:") || (c2 !=
"Sigma:") ) {
303 std::cerr <<
"i/o problem while expecting to read state of a "
304 <<
name() <<
" distribution\n"
305 <<
"default mean and/or sigma could not be read\n";
309 if ( (!is) || (c1 !=
"RANDGAUSS") ) {
310 is.clear(std::ios::badbit | is.rdstate());
311 std::cerr <<
"Failure when reading caching state of RandGauss\n";
314 if (c2 ==
"CACHED_GAUSSIAN:") {
316 }
else if (c2 ==
"NO_CACHED_GAUSSIAN:") {
319 is.clear(std::ios::badbit | is.rdstate());
320 std::cerr <<
"Unexpected caching state keyword of RandGauss:" << c2
321 <<
"\nistream is left in the badbit state\n";
329 int prec = os.precision(20);
330 std::vector<unsigned long>
t(2);
335 os <<
"nextGauss_st " <<
getVal() <<
" " << t[0] <<
" " << t[1] <<
"\n";
337 os <<
"no_cached_nextGauss_st \n";
347 is.clear(std::ios::badbit | is.rdstate());
348 std::cerr <<
"Mismatch when expecting to read static state of a "
350 <<
"Name found was " << inName
351 <<
"\nistream is left in the badbit state\n";
357 std::vector<unsigned long>
t(2);
361 if (ng ==
"nextGauss_st") {
370 if ( (!is) || (c1 !=
"RANDGAUSS") ) {
371 is.clear(std::ios::badbit | is.rdstate());
372 std::cerr <<
"Failure when reading caching state of static RandGauss\n";
375 if (c2 ==
"CACHED_GAUSSIAN:") {
377 }
else if (c2 ==
"NO_CACHED_GAUSSIAN:") {
380 is.clear(std::ios::badbit | is.rdstate());
381 std::cerr <<
"Unexpected caching state keyword of static RandGauss:" << c2
382 <<
"\nistream is left in the badbit state\n";