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