LCOV - code coverage report
Current view: top level - builds/DaniloBorquez/flex-net-sim/src - uniform_variable.cpp (source / functions) Hit Total Coverage
Test: commit SHA1 Lines: 10 11 90.9 %
Date: 2026-11-18 13:04:43 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #include "uniform_variable.hpp"
       2             : #include "numeric.hpp"
       3             : 
       4           0 : UniformVariable::UniformVariable(void) : RandomVariable() {}
       5             : 
       6          35 : UniformVariable::UniformVariable(unsigned int seed, double parameter1) {
       7          35 :   if (parameter1 < 0) {
       8          10 :     throw std::runtime_error("Parameter 1 must be non-negative.");
       9             :   }
      10             :   const int upperBound =
      11          25 :       fnsim_numeric::doubleToInt(parameter1, "uniform upper bound");
      12          16 :   this->generator = std::mt19937(seed);
      13          16 :   this->parameter1 = parameter1;
      14          16 :   this->dist = std::uniform_int_distribution<int>(0, upperBound);
      15          16 : }
      16             : 
      17         600 : double UniformVariable::getNextValue(void) { return dist(this->generator); }
      18        1600 : double UniformVariable::getNextIntValue(void) { return dist(this->generator); }

Generated by: LCOV version 1.13