/* Web Polygraph http://www.web-polygraph.org/
* (C) 2003-2006 The Measurement Factory
* Licensed under the Apache License, Version 2.0 */
#include "base/polygraph.h"
#include <limits.h>
#include <stdlib.h>
#include "xstd/Rnd.h"
#include "xstd/String.h"
#include "xstd/gadgets.h"
#include "base/RndPermut.h"
#include "base/polyVersion.h"
static
int uncorr(int n) {
//int exp;
//const double x = INT_MAX * (2*frexp(::sin((double)n), &exp) - 1);
const double x = INT_MAX * ::sin(n*(double)n);
const double y = fabs(x);
return (int)Min(y, (double)INT_MAX);
}
int main(int argc, char *argv[]) {
(void)PolyVersion();
int sampleCount = -1;
if (argc != 2 || !isInt(argv[1], sampleCount)) {
cerr << "usage: " << argv[0] << " <number_of_samples>" << endl;
return 0;
}
RndGen rngCont;
RndGen rngSeeded;
RndGen rngPermut;
for (int i = 1; i <= sampleCount; ++i) {
rngSeeded.seed(i);
rngPermut.seed(LclPermut(i));
cout
<< ' ' << rngCont.ltrial()
<< ' ' << rngSeeded.ltrial()
<< ' ' << rngPermut.ltrial()
<< ' ' << uncorr(i)
<< endl;
}
return 0;
}
syntax highlighted by Code2HTML, v. 0.9.1