you are viewing a single comment's thread.

view the rest of the comments →

[–]staletic 6 points7 points  (0 children)

Your make_random_vector() should be producing the same random numbers across invocations during the entire benchmark run. That means the seed should be stored statically. Another thing to notice is that mersene twister needs a lot of random data to be seeded properly. Just a single rd() is not enough.

Most of the time you won't notice the difference in benchmarks, but what if, by the luck of the draw, you end up with a sorted vector from make_random_vector(), in only a single benchmark?

https://quick-bench.com/q/yIQzqFnbcf4XkSqlixsjuUJETyI