MCPcopy Create free account
hub / github.com/davisking/dlib / test_get_integer

Function test_get_integer

dlib/test/rand.cpp:385–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383 }
384
385 void test_get_integer()
386 {
387
388 print_spinner();
389 dlib::rand rnd;
390
391
392 int big_val = 0;
393 int small_val = 0;
394
395 const long long maxval = (((unsigned long long)1)<<62) + (((unsigned long long)1)<<61);
396 for (int i = 0; i < 10000000; ++i)
397 {
398 if (rnd.get_integer(maxval) > maxval/2)
399 ++big_val;
400 else
401 ++small_val;
402 }
403
404 // make sure there isn't any funny bias
405 DLIB_TEST(std::abs(big_val/(double)small_val - 1) < 0.001);
406
407 //cout << big_val/(double)small_val << endl;
408
409 }
410
411 void test_weibull_distribution()
412 {

Callers 1

perform_testMethod · 0.85

Calls 3

print_spinnerFunction · 0.85
absFunction · 0.85
get_integerMethod · 0.80

Tested by

no test coverage detected