diff options
Diffstat (limited to 'source/test/unittests/mersenne_twister_64.test.c')
-rw-r--r-- | source/test/unittests/mersenne_twister_64.test.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/test/unittests/mersenne_twister_64.test.c b/source/test/unittests/mersenne_twister_64.test.c index 80d1c2c..e523154 100644 --- a/source/test/unittests/mersenne_twister_64.test.c +++ b/source/test/unittests/mersenne_twister_64.test.c @@ -7,7 +7,8 @@ enum { SIZE = 1000 }; TEST("mt64 same seeds") { - uint64_t seed; + ptrdiff_t i; + uint64_t seed; secure_random(sizeof seed, &seed); mt64_state_t foo, bar; @@ -15,19 +16,21 @@ TEST("mt64 same seeds") { mt64_init(&bar, seed); int ok = 1; - for (ptrdiff_t i = 0; i < SIZE; i++) + for (i = 0; i < SIZE; i++) ok = ok && mt64_generate(&foo) == mt64_generate(&bar); REQUIRE(ok); } TEST("mt64 different seeds") { + ptrdiff_t i; + mt64_state_t foo, bar; mt64_init(&foo, 42); mt64_init(&bar, 4242424242); ptrdiff_t difference_count = 0; - for (ptrdiff_t i = 0; i < SIZE; i++) + for (i = 0; i < SIZE; i++) if (mt64_generate(&foo) != mt64_generate(&bar)) difference_count++; |