View | Details | Raw Unified | Return to bug 512
Collapse All | Expand All

(-)a/src/core/random-variable.cc (+5 lines)
 Lines 274-279   double UniformVariable::GetValue(double Link Here 
274
  return ((UniformVariableImpl*)Peek())->GetValue(s,l);
274
  return ((UniformVariableImpl*)Peek())->GetValue(s,l);
275
}
275
}
276
276
277
uint32_t UniformVariable::GetInteger (uint32_t s, uint32_t l)
278
{
279
  NS_ASSERT(s <= l);
280
  return static_cast<uint32_t>( GetValue(s, l+1) );
281
}
277
282
278
//-----------------------------------------------------------------------------
283
//-----------------------------------------------------------------------------
279
//-----------------------------------------------------------------------------
284
//-----------------------------------------------------------------------------
(-)a/src/core/random-variable.h (+7 lines)
 Lines 194-199   public: Link Here 
194
  */
194
  */
195
  double GetValue(double s, double l);
195
  double GetValue(double s, double l);
196
196
197
  /**
198
   * \brief Returns a random unsigned integer from the interval [s,l] including both ends.
199
   * \param s Low end of the range
200
   * \param l High end of the range
201
   * \return A random unsigned integer value.
202
   */
203
  uint32_t GetInteger (uint32_t s, uint32_t l);
197
};
204
};
198
205
199
/**
206
/**
(-)a/src/devices/wifi/random-stream.cc (-1 / +1 lines)
 Lines 34-40   RealRandomStream::RealRandomStream () Link Here 
34
uint32_t 
34
uint32_t 
35
RealRandomStream::GetNext (uint32_t min, uint32_t max)
35
RealRandomStream::GetNext (uint32_t min, uint32_t max)
36
{
36
{
37
  return static_cast<uint32_t> (round (m_stream.GetValue (min, max)));
37
  return m_stream.GetInteger (min, max);
38
}
38
}
39
39
40
40

Return to bug 512