Class RandomFloatingGenerator

Synopsis

#include <include/internal/catch_generators_specific.hpp>

template <typename Float>
class RandomFloatingGenerator final : public IGenerator<Float>

Description

No description yet.

Inheritance

Ancestors: IGenerator

Methods

RandomFloatingGenerator
get
next

Source

Lines 20-40 in include/internal/catch_generators_specific.hpp.

template <typename Float>
class RandomFloatingGenerator final : public IGenerator<Float> {
    Catch::SimplePcg32& m_rng;
    std::uniform_real_distribution<Float> m_dist;
    Float m_current_number;
public:

    RandomFloatingGenerator(Float a, Float b):
        m_rng(rng()),
        m_dist(a, b) {
        static_cast<void>(next());
    }

    Float const& get() const override {
        return m_current_number;
    }
    bool next() override {
        m_current_number = m_dist(m_rng);
        return true;
    }
};





Add Discussion as Guest

Log in