pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
random.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_RANDOM_H
4#define pRC_CORE_VALUE_RANDOM_H
5
8
9namespace pRC
10{
18 template<class T, template<class...> class D>
19 struct Random<T, D<T>, If<All<IsValue<T>, IsDistribution<D<T>>>>>
20 {
21 public:
23 : mRNG(rng)
24 , mDistribution(distribution)
25 {
26 }
27
28 constexpr auto operator()()
29 {
30 return mDistribution(mRNG);
31 }
32
33 private:
34 RandomEngine &mRNG;
35 D<T> &mDistribution;
36 };
37}
38#endif // pRC_CORE_VALUE_RANDOM_H
Definition threefry.hpp:24
Definition cholesky.hpp:18
std::conjunction< Bs... > All
Definition type_traits.hpp:77
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
Any< IsFloat< T >, IsInteger< T > > IsValue
Definition type_traits.hpp:72
Definition type_traits.hpp:32
Random(RandomEngine &rng, D< T > &distribution)
Definition random.hpp:22
Definition random.hpp:12