NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
uniform.hpp
Go to the documentation of this file.
1
28#pragma once
29
32
33namespace nc::random
34{
35 namespace detail
36 {
37 //============================================================================
38 // Method Description:
52 template<typename dtype, typename GeneratorType = std::mt19937>
53 dtype uniform(GeneratorType& generator, dtype inLow, dtype inHigh)
54 {
56
57 return detail::randFloat(generator, inLow, inHigh);
58 }
59
60 //============================================================================
61 // Method Description:
76 template<typename dtype, typename GeneratorType = std::mt19937>
77 NdArray<dtype> uniform(GeneratorType& generator, const Shape& inShape, dtype inLow, dtype inHigh)
78 {
80
81 return detail::randFloat(generator, inShape, inLow, inHigh);
82 }
83 } // namespace detail
84
85 //============================================================================
86 // Method Description:
99 template<typename dtype>
100 dtype uniform(dtype inLow, dtype inHigh)
101 {
102 return detail::uniform(generator_, inLow, inHigh);
103 }
104
105 //============================================================================
106 // Method Description:
120 template<typename dtype>
121 NdArray<dtype> uniform(const Shape& inShape, dtype inLow, dtype inHigh)
122 {
123 return detail::uniform(generator_, inShape, inLow, inHigh);
124 }
125} // namespace nc::random
#define STATIC_ASSERT_FLOAT(dtype)
Definition StaticAsserts.hpp:50
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:135
A Shape Class for NdArrays.
Definition Core/shape.hpp:41
Definition Random/bernoulli.hpp:41
dtype randFloat(GeneratorType &generator, dtype inLow, dtype inHigh=0.)
Definition randFloat.hpp:60
dtype uniform(GeneratorType &generator, dtype inLow, dtype inHigh)
Definition uniform.hpp:53
Definition Random/bernoulli.hpp:39
std::mt19937_64 generator_
generator function
Definition generator.hpp:35
dtype uniform(dtype inLow, dtype inHigh)
Definition uniform.hpp:100