]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/random-test.c
Random: Switched flags and buf_size arguments of strongrand (slightly nicer usage).
[libucw.git] / ucw / random-test.c
index 2fd375956b1c2e08b8008aa551d39e0d72a4d867..59d54b6ca032a7a1d8da5225f11700e5f2d7f724 100644 (file)
@@ -88,7 +88,7 @@ static void test_strong(void)
   byte buf[100];
   for (uint j = 0; j < 2; j++)
     {
-      struct strongrand *r = strongrand_std_open((j == 0) ? 0 : 128, STRONGRAND_STD_URANDOM);
+      struct strongrand *r = strongrand_std_open(STRONGRAND_STD_URANDOM, (j == 0) ? 0 : 128);
       for (uint i = 1; i <= 100; i++)
        {
          strongrand_mem(r, buf, i);
@@ -216,19 +216,19 @@ static void bench_strong(void)
   struct strongrand *r;
 
   msg(L_INFO, "Benchmarking unbuffered strong random generator");
-  r = strongrand_std_open(0, STRONGRAND_STD_URANDOM);
+  r = strongrand_std_open(STRONGRAND_STD_URANDOM, 0);
   BENCH_SLOW(50, strongrand_mem(r, buf, 1));
   BENCH_SLOW(200, strongrand_mem(r, buf, 100));
   strongrand_close(r);
 
   msg(L_INFO, "Benchmarking buffered strong random generator");
-  r = strongrand_std_open(128, STRONGRAND_STD_URANDOM);
+  r = strongrand_std_open(STRONGRAND_STD_URANDOM, 128);
   BENCH_SLOW(50, strongrand_mem(r, buf, 1));
   BENCH_SLOW(200, strongrand_mem(r, buf, 100));
   strongrand_close(r);
 
   msg(L_INFO, "Benchmarking buffered strong random generator with autoreset");
-  r = strongrand_std_open(128, STRONGRAND_STD_URANDOM | STRONGRAND_STD_AUTO_RESET);
+  r = strongrand_std_open(STRONGRAND_STD_URANDOM | STRONGRAND_STD_AUTO_RESET, 128);
   BENCH_SLOW(50, strongrand_mem(r, buf, 1));
   BENCH_SLOW(200, strongrand_mem(r, buf, 100));
   strongrand_close(r);