TiagoMSSantos/MobileRT

View on GitHub
app/Components/Samplers/MersenneTwister.cpp

Summary

Maintainability
Test Coverage
#include "Components/Samplers/MersenneTwister.hpp"

using ::Components::MersenneTwister;

float MersenneTwister::getSample(const ::std::uint32_t /*sample*/) {
    thread_local static ::std::uniform_real_distribution<float> uniformDist {0.0F, 1.0F};
    thread_local static ::std::random_device randomDevice {};
    thread_local static ::std::mt19937 generator {randomDevice()};
    const float res {uniformDist(generator)};
    return res;
}