NumCpp  2.8.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
shuffle.hpp
Go to the documentation of this file.
1 #pragma once
30 
31 #include <algorithm>
32 
33 #include "NumCpp/NdArray.hpp"
35 
36 namespace nc
37 {
38  namespace random
39  {
40  namespace detail
41  {
42  //============================================================================
43  // Method Description:
49  template<typename dtype, typename GeneratorType = std::mt19937>
50  void shuffle(GeneratorType& generator, NdArray<dtype>& inArray)
51  {
52  std::shuffle(inArray.begin(), inArray.end(), generator);
53  }
54  } // namespace detail
55 
56  //============================================================================
57  // Method Description:
62  template<typename dtype>
63  void shuffle(NdArray<dtype>& inArray)
64  {
65  return detail::shuffle(generator_, inArray);
66  }
67  } // namespace random
68 } // namespace nc
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
iterator end() noexcept
Definition: NdArrayCore.hpp:1479
iterator begin() noexcept
Definition: NdArrayCore.hpp:1171
void shuffle(GeneratorType &generator, NdArray< dtype > &inArray)
Definition: shuffle.hpp:50
static std::mt19937_64 generator_
generator function
Definition: generator.hpp:37
void shuffle(NdArray< dtype > &inArray)
Definition: shuffle.hpp:63
Definition: Coordinate.hpp:45