| 38 | } |
| 39 | |
| 40 | template<typename Scalar> void check_histogram(Scalar x, Scalar y, int bins) |
| 41 | { |
| 42 | Array<int,1,Dynamic> hist(bins); |
| 43 | hist.fill(0); |
| 44 | int f = 100000; |
| 45 | int n = bins*f; |
| 46 | int64 range = int64(y)-int64(x); |
| 47 | int divisor = int((range+1)/bins); |
| 48 | assert(((range+1)%bins)==0); |
| 49 | for(int k=0; k<n; ++k) |
| 50 | { |
| 51 | Scalar r = check_in_range(x,y); |
| 52 | hist( int((int64(r)-int64(x))/divisor) )++; |
| 53 | } |
| 54 | VERIFY( (((hist.cast<double>()/double(f))-1.0).abs()<0.02).all() ); |
| 55 | } |
| 56 | |
| 57 | void test_rand() |
| 58 | { |
nothing calls this directly
no test coverage detected