Mathieu's patch: update users of GetSingleValue
This commit is contained in:
@@ -40,6 +40,7 @@ Backoff::Backoff(Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t c
|
||||
m_maxSlots = maxSlots;
|
||||
m_ceiling = ceiling;
|
||||
m_maxRetries = maxRetries;
|
||||
m_rng = UniformVariable ();
|
||||
}
|
||||
|
||||
Time
|
||||
@@ -64,8 +65,7 @@ Backoff::GetBackoffTime (void)
|
||||
maxSlot = m_maxSlots;
|
||||
}
|
||||
|
||||
UniformVariable rng;
|
||||
uint32_t backoffSlots = (uint32_t)rng.GetValue(minSlot, maxSlot);
|
||||
uint32_t backoffSlots = (uint32_t)m_rng.GetValue(minSlot, maxSlot);
|
||||
|
||||
backoff = Scalar(backoffSlots) * m_slotTime;
|
||||
return (backoff);
|
||||
|
||||
@@ -93,9 +93,10 @@ private:
|
||||
* Number of times that the transmitter has tried to unsuccessfully transmit the current packet.
|
||||
*/
|
||||
uint32_t m_numBackoffRetries;
|
||||
UniformVariable m_rng;
|
||||
};
|
||||
|
||||
}; // namespace ns3
|
||||
} // namespace ns3
|
||||
|
||||
#endif // BACKOFF_H
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#include "random-stream.h"
|
||||
#include "ns3/rng-stream.h"
|
||||
#include "ns3/assert.h"
|
||||
|
||||
namespace ns3 {
|
||||
@@ -28,13 +27,12 @@ RandomStream::~RandomStream ()
|
||||
|
||||
|
||||
RealRandomStream::RealRandomStream ()
|
||||
{
|
||||
m_stream.InitializeStream();
|
||||
}
|
||||
: m_stream (UniformVariable ())
|
||||
{}
|
||||
uint32_t
|
||||
RealRandomStream::GetNext (uint32_t min, uint32_t max)
|
||||
{
|
||||
return m_stream.RandInt (min, max);
|
||||
return m_stream.GetValue (min, max);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <list>
|
||||
#include "ns3/rng-stream.h"
|
||||
#include "ns3/random-variable.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
RealRandomStream ();
|
||||
virtual uint32_t GetNext (uint32_t min, uint32_t max);
|
||||
private:
|
||||
RngStream m_stream;
|
||||
UniformVariable m_stream;
|
||||
};
|
||||
|
||||
class TestRandomStream : public RandomStream
|
||||
|
||||
@@ -69,7 +69,7 @@ RandomDirection2dMobilityModel::DoDispose (void)
|
||||
void
|
||||
RandomDirection2dMobilityModel::Start (void)
|
||||
{
|
||||
double direction = UniformVariable().GetValue (0, 2 * PI);
|
||||
double direction = m_direction.GetValue (0, 2 * PI);
|
||||
SetDirectionAndSpeed (direction);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ RandomDirection2dMobilityModel::SetDirectionAndSpeed (double direction)
|
||||
void
|
||||
RandomDirection2dMobilityModel::ResetDirectionAndSpeed (void)
|
||||
{
|
||||
double direction = UniformVariable().GetValue (0, PI);
|
||||
double direction = m_direction.GetValue (0, PI);
|
||||
|
||||
m_helper.UpdateWithBounds (m_bounds);
|
||||
Vector position = m_helper.GetCurrentPosition ();
|
||||
|
||||
@@ -58,6 +58,7 @@ class RandomDirection2dMobilityModel : public MobilityModel
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
|
||||
static const double PI;
|
||||
UniformVariable m_direction;
|
||||
Rectangle m_bounds;
|
||||
RandomVariable m_speed;
|
||||
RandomVariable m_pause;
|
||||
|
||||
Reference in New Issue
Block a user