anchor.diff:  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   
   %% Not a test but measures the time characteristics of the different algorithms
  -measure(Config) ->
  +measure(Config) when is_list(Config) ->
       ct:timetrap({minutes,60}), %% valgrind needs a lot of time
       case ct:get_timetrap_info() of
           {_,{_,1}} -> % No scaling
  -            do_measure(Config);
  +            Iterations = ?LOOP div 5,
  +            Effort = proplists:get_value(measure_effort, Config, 1),
  +            do_measure(Iterations * Effort);
           {_,{_,Scale}} ->
               {skip,{will_not_run_in_scaled_time,Scale}}
       end.
  
positive.code:                 <<Part/binary, (crypto:strong_rand_bytes(N * 16))/binary>>,
              {Bytes, Rest}
      end;
  bytes_s(N, ignored_state = St) ->
      %% crypto_bytes
      {crypto:strong_rand_bytes(N), St}.
  
  
negative.code:     TwoPi = 2 * math:pi(),
      _ =
          measure_1(
            fun (Mod, _State) ->
                    fun (St0) ->
                            {U1, St1} = Mod:uniform_real_s(St0),
                            {U2, St2} = Mod:uniform_s(St1),
                            R = math:sqrt(-2.0 * math:log(U1)),
                            T = TwoPi * U2,
                            Z0 = R * math:cos(T),
                            Z1 = R * math:sin(T),
                            ?CHECK_NORMAL({Z0 + Z1, St2}, X, St3)
                    end
            end,
            exsss, Iterations,
            TMarkNormalFloat, OverheadNormalFloat),
      ok.
  
  measure_loop(State, Fun, I) when 10 =< I ->
      %% Loop unrolling to dilute benchmark overhead...
      measure_loop(
        Fun(Fun(Fun(Fun(Fun(
                          Fun(Fun(Fun(Fun(Fun(
                                            State)))))))))),
        Fun,
        I - 10);
  measure_loop(State, Fun, I) when 1 =< I ->
      measure_loop(Fun(State), Fun, I - 1);
  measure_loop(_, _, _) ->
      ok.
  
  measure_1(InitFun, Algs, Iterations) ->
      WMark = measure_1(InitFun, hd(Algs), Iterations, warm_up, 0),
      Overhead =
          measure_1(
            fun (_Mod, _State) ->
                    Range = 1,
                    fun (St0)
                        when is_integer(St0), 1 =< St0, St0 =< Range ->
                            St0
                    end
            end, overhead, Iterations, WMark, 0),
      TMark = measure_1(InitFun, hd(Algs), Iterations, undefined, Overhead),
      [TMark,Overhead] ++
          [measure_1(InitFun, Alg, Iterations, TMark, Overhead)
           || Alg <- tl(Algs)].
  
  measure_1(InitFun, Alg, Iterations, TMark, Overhead) ->
      Parent = self(),
      MeasureFun =
          fun () ->
                  {Mod, State} = measure_init(Alg),
                  IterFun = InitFun(Mod, State),
                  {T, ok} =
                      timer:tc(
                        fun () ->
                                measure_loop(State, IterFun, Iterations)
                        end),
                  Time = T - Overhead,
                  Percent =
                      case TMark of
                          warm_up   -> "(warm-up)";
                          undefined -> "   100.0%";
                          _ ->
                              io_lib:format(
                                "~8.1f%", [(Time * 100 + 50) / TMark])
                      end,
                  io:format(
                    "~.24w: ~8.1f ns ~s~n",
                    [Alg, (Time * 1000 + 500) / Iterations, Percent]),
                  Parent ! {self(), Time},
                  ok
          end,
      Pid = spawn_link(MeasureFun),
      receive
  	{Pid, Msg} -> Msg
      end.
  
  measure_init(Alg) ->
      case Alg of
          overhead ->
              {?MODULE, 1};
          crypto64 ->
              {rand, crypto64_seed()};
          crypto_cache ->
              {rand, crypto:rand_seed_alg(crypto_cache)};
          crypto ->
              {rand, crypto:rand_seed_s()};
          crypto_aes ->
              {rand,
               crypto:rand_seed_alg(
                 crypto_aes, crypto:strong_rand_bytes(256))};
          random ->
              {random, random:seed(os:timestamp()), get(random_seed)};
          crypto_bytes ->
              {?MODULE, undefined};
          crypto_bytes_cached ->
              {?MODULE, <<>>};
          unique_phash2 ->
              {?MODULE, undefined};
          system_time_rem ->
              {?MODULE, undefined};
          mcg35_inline ->
              {_, S} = rand:seed_s(dummy),
              {rand, (S rem ((1 bsl 35)-31 - 1)) + 1};
          lcg35_inline ->
              {_, S} = rand:seed_s(dummy),
              {rand, S bsr (58-35)};
          lcg35_procdict ->
              {_, S} = rand:seed_s(dummy),
              _ = put(Alg, S bsr (58-35)),
              {rand, undefined};
          exsp_inline ->
              {_, S} = rand:seed_s(exsp),
              {rand, S};
          procdict ->
              {rand, rand:seed(exsss)};
          _ ->
              {rand, rand:seed_s(Alg)}
      end.
  
  %% Comparison algorithm for rand:bytes_s/2 vs. crypto:strong_rand_bytes/1
  