NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
uniform.hpp
Go to the documentation of this file.
1
28#pragma once
29
33
34namespace nc::random
35{
36 namespace detail
37 {
38 //============================================================================
39 // Method Description:
53 template<typename dtype, typename GeneratorType = std::mt19937>
54 dtype uniform(GeneratorType& generator, dtype inLow, dtype inHigh)
55 {
57
58 return detail::randFloat(generator, inLow, inHigh);
59 }
60
61 //============================================================================
62 // Method Description:
77 template<typename dtype, typename GeneratorType = std::mt19937>
78 NdArray<dtype> uniform(GeneratorType& generator, const Shape& inShape, dtype inLow, dtype inHigh)
79 {
81
82 return detail::randFloat(generator, inShape, inLow, inHigh);
83 }
84 } // namespace detail
85
86 //============================================================================
87 // Method Description:
100 template<typename dtype>
101 dtype uniform(dtype inLow, dtype inHigh)
102 {
103 return detail::uniform(generator_, inLow, inHigh);
104 }
105
106 //============================================================================
107 // Method Description:
121 template<typename dtype>
122 NdArray<dtype> uniform(const Shape& inShape, dtype inLow, dtype inHigh)
123 {
124 return detail::uniform(generator_, inShape, inLow, inHigh);
125 }
126} // 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:139
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
dtype randFloat(GeneratorType &generator, dtype inLow, dtype inHigh=0.)
Definition: randFloat.hpp:61
dtype uniform(GeneratorType &generator, dtype inLow, dtype inHigh)
Definition: uniform.hpp:54
Definition: Random/bernoulli.hpp:41
static std::mt19937_64 generator_
generator function
Definition: generator.hpp:35
dtype uniform(dtype inLow, dtype inHigh)
Definition: uniform.hpp:101