LCOV - code coverage report
Current view: top level - src/duplicable - duplicable.js (source / functions) Hit Total Coverage
Test: cov_profile.lcov Lines: 11 11 100.0 %
Date: 2021-12-16 00:47:58 Functions: 1 1 100.0 %
Branches: 2 2 100.0 %

           Branch data     Line data    Source code
       1                 :          8 : // 10% of the time, reseed with one of 10 seeds
       2            [ + ]:          8 : // frequency and pool can be overriden
       3                 :          8 : // TODO: does changing seed change the duplicated values..? I think it should!
       4                 :          8 : const duplicable = (seeded, { frequency = 0.1, pool = 10 } = {}) => {
       5                 :         34 :   if (seeded.random() <= frequency) {
       6            [ + ]:         52 :     seeded.reset((Math.floor(seeded.random() * pool + 1) / pool + 1) * 1e16);
       7                 :         34 :   }
       8                 :         34 :   return seeded;
       9                 :          8 : };
      10                 :          8 : 
      11                 :          4 : export default duplicable;

Generated by: LCOV version 1.15