node-dot-cpp / alloc-test

Cross-platform benchmarking for memory allocators, aiming to be as close to real world as it is practical
BSD 3-Clause "New" or "Revised" License
43 stars 12 forks source link

Unseeded random generator is used, it returns always 0 #7

Open mezkov opened 4 years ago

mezkov commented 4 years ago

Random number generation algorith actually used (the one not commented out) cannot be used with seed of 0, because it will never change the seed value to anything else and will always generate 0. But default constructor initializes the seed to zero causing the instance is unusable until PRNG::seed() method is called with nonzero value.

The default constructed PRNG instance without calling PRNG::seed() is used in the actual test to generate slot index and size of the block. So it always picks slot 0, allocates 5 bytes block in it and deallocates it in the next loop. Which makes the test pretty useless.