test/random_test.cc
changeset 1379 db1d342a1087
parent 463 88ed40ad0d4f
     1.1 --- a/test/random_test.cc	Thu Oct 08 10:13:24 2015 +0200
     1.2 +++ b/test/random_test.cc	Thu Oct 08 13:48:09 2015 +0200
     1.3 @@ -21,6 +21,33 @@
     1.4  
     1.5  int seed_array[] = {1, 2};
     1.6  
     1.7 +int rnd_seq32[] = {
     1.8 +2732, 43567, 42613, 52416, 45891, 21243, 30403, 32103, 
     1.9 +62501, 33003, 12172, 5192, 32511, 50057, 43723, 7813, 
    1.10 +23720, 35343, 6637, 30280, 44566, 31019, 18898, 33867, 
    1.11 +5994, 1688, 11513, 59011, 48056, 25544, 39168, 25365, 
    1.12 +17530, 8366, 27063, 49861, 55169, 63848, 11863, 49608
    1.13 +};
    1.14 +int rnd_seq64[] = {
    1.15 +56382, 63883, 59577, 64750, 9644, 59886, 57647, 18152, 
    1.16 +28520, 64078, 17818, 49294, 26424, 26697, 53684, 19209, 
    1.17 +35404, 12121, 12837, 11827, 32156, 58333, 62553, 7907, 
    1.18 +64427, 39399, 21971, 48789, 46981, 15716, 53335, 65256, 
    1.19 +12999, 15308, 10906, 42162, 47587, 43006, 53921, 18716
    1.20 +};
    1.21 +
    1.22 +void seq_test() {
    1.23 +  for(int i=0;i<5;i++) {
    1.24 +    lemon::Random32 r32(i);
    1.25 +    lemon::Random64 r64(i);
    1.26 +    for(int j=0;j<8;j++) {
    1.27 +      check(r32[65536]==rnd_seq32[i*8+j], "Wrong random sequence");
    1.28 +      check(r64[65536]==rnd_seq64[i*8+j], "Wrong random sequence");
    1.29 +    }
    1.30 +  }
    1.31 +}
    1.32 +
    1.33 +
    1.34  int main()
    1.35  {
    1.36    double a=lemon::rnd();
    1.37 @@ -36,5 +63,6 @@
    1.38    lemon::rnd.seed(seed_array, seed_array +
    1.39                    (sizeof(seed_array) / sizeof(seed_array[0])));
    1.40  
    1.41 +  seq_test();
    1.42    return 0;
    1.43  }