//          Copyright Carl Philipp Reh 2009 - 2021.
// Distributed under the Boost Software License, Version 1.0.
//    (See accompanying file LICENSE_1_0.txt or copy at
//          http://www.boost.org/LICENSE_1_0.txt)

#ifndef FCPPT_RANDOM_WRAPPER_UNIFORM_CONTAINER_IMPL_HPP_INCLUDED
#define FCPPT_RANDOM_WRAPPER_UNIFORM_CONTAINER_IMPL_HPP_INCLUDED

#include <fcppt/random/distribution/make_basic.hpp>
#include <fcppt/random/wrapper/uniform_container_decl.hpp> // IWYU pragma: export

template <typename Container, typename IntDistribution>
fcppt::random::wrapper::uniform_container<Container, IntDistribution>::uniform_container(
    container_reference const _container, param_type const &_parameters)
    : container_(_container), distribution_(fcppt::random::distribution::make_basic(_parameters))
{
}

template <typename Container, typename IntDistribution>
template <typename Generator>
fcppt::random::wrapper::uniform_container<Container, IntDistribution>::result_type
fcppt::random::wrapper::uniform_container<Container, IntDistribution>::operator()(
    Generator &_generator)
{
  // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-avoid-unchecked-container-access)
  return container_.get()[distribution_(_generator)];
}

#endif
