diff --git a/src/spectrum/model/three-gpp-channel-model.cc b/src/spectrum/model/three-gpp-channel-model.cc index 2bf970410..f3892a360 100644 --- a/src/spectrum/model/three-gpp-channel-model.cc +++ b/src/spectrum/model/three-gpp-channel-model.cc @@ -18,6 +18,7 @@ #include "ns3/node.h" #include "ns3/phased-array-model.h" #include "ns3/pointer.h" +#include "ns3/shuffle.h" #include "ns3/simulator.h" #include "ns3/string.h" @@ -3039,10 +3040,10 @@ ThreeGppChannelModel::GenerateChannelParameters(const Ptrm_reducedClusterNumber; cIndex++) { - Shuffle(&rayAodRadian[cIndex][0], &rayAodRadian[cIndex][table3gpp->m_raysPerCluster]); - Shuffle(&rayAoaRadian[cIndex][0], &rayAoaRadian[cIndex][table3gpp->m_raysPerCluster]); - Shuffle(&rayZodRadian[cIndex][0], &rayZodRadian[cIndex][table3gpp->m_raysPerCluster]); - Shuffle(&rayZoaRadian[cIndex][0], &rayZoaRadian[cIndex][table3gpp->m_raysPerCluster]); + Shuffle(rayAodRadian[cIndex].begin(), rayAodRadian[cIndex].end(), m_uniformRvShuffle); + Shuffle(rayAoaRadian[cIndex].begin(), rayAoaRadian[cIndex].end(), m_uniformRvShuffle); + Shuffle(rayZodRadian[cIndex].begin(), rayZodRadian[cIndex].end(), m_uniformRvShuffle); + Shuffle(rayZoaRadian[cIndex].begin(), rayZoaRadian[cIndex].end(), m_uniformRvShuffle); } // store values @@ -3868,15 +3869,6 @@ ThreeGppChannelModel::CalcAttenuationOfBlockage( return powerAttenuation; } -void -ThreeGppChannelModel::Shuffle(double* first, double* last) const -{ - for (auto i = (last - first) - 1; i > 0; --i) - { - std::swap(first[i], first[m_uniformRvShuffle->GetInteger(0, i)]); - } -} - int64_t ThreeGppChannelModel::AssignStreams(int64_t stream) { diff --git a/src/spectrum/model/three-gpp-channel-model.h b/src/spectrum/model/three-gpp-channel-model.h index fea8d299d..41ff897f9 100644 --- a/src/spectrum/model/three-gpp-channel-model.h +++ b/src/spectrum/model/three-gpp-channel-model.h @@ -143,13 +143,6 @@ class ThreeGppChannelModel : public MatrixBasedChannelModel */ static std::pair WrapAngles(double azimuthRad, double inclinationRad); - /** - * @brief Shuffle the elements of a simple sequence container of type double - * @param first Pointer to the first element among the elements to be shuffled - * @param last Pointer to the last element among the elements to be shuffled - */ - void Shuffle(double* first, double* last) const; - /** * Extends the struct ChannelParams by including information that is used * within the ThreeGppChannelModel class