jni/src/unittest/test_nodedef.cpp \
jni/src/unittest/test_noise.cpp \
jni/src/unittest/test_profiler.cpp \
+ jni/src/unittest/test_random.cpp \
jni/src/unittest/test_serialization.cpp \
jni/src/unittest/test_settings.cpp \
jni/src/unittest/test_socket.cpp \
s32 accum = 0;
for (int i = 0; i != num_trials; i++)
accum += range(min, max);
- return round((float)accum / num_trials);
+ return myround((float)accum / num_trials);
}
///////////////////////////////////////////////////////////////////////////////
EXCEPTION_CHECK(PrngException, pr.range(5, 1));
for (u32 i = 0; i != 32768; i++) {
- int min = pr.next() % 3000;
- int max = pr.next() % 3000;
- if (min > max) {
- int temp = min;
- min = max;
- max = temp;
- }
+ int min = (pr.next() % 3000) - 500;
+ int max = (pr.next() % 3000) - 500;
+ if (min > max)
+ SWAP(int, min, max);
int randval = pr.range(min, max);
UASSERT(randval >= min);
EXCEPTION_CHECK(PrngException, pr.range(5, 1));
for (u32 i = 0; i != 32768; i++) {
- int min = pr.next() % 3000;
- int max = pr.next() % 3000;
- if (min > max) {
- int temp = min;
- min = max;
- max = temp;
- }
+ int min = (pr.next() % 3000) - 500;
+ int max = (pr.next() % 3000) - 500;
+ if (min > max)
+ SWAP(int, min, max);
int randval = pr.range(min, max);
UASSERT(randval >= min);
s32 bins[max - min + 1];
memset(bins, 0, sizeof(bins));
- PcgRandom r(486456179 + (int)time(NULL));
+ PcgRandom r(486179 + (int)time(NULL));
for (u32 i = 0; i != num_samples; i++) {
s32 randval = r.randNormalDist(min, max, num_trials);
//// Simple normality test using the 68-95-99.7% rule
for (u32 i = 0; i != ARRLEN(prediction_intervals); i++) {
float deviations = i / 2.f + 1.f;
- int lbound = round(mean - deviations * stddev);
- int ubound = round(mean + deviations * stddev);
+ int lbound = myround(mean - deviations * stddev);
+ int ubound = myround(mean + deviations * stddev);
UASSERT(lbound >= min);
UASSERT(ubound <= max);