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

(-)a/src/core/random-variable.cc (-1 / +6 lines)
 Lines 271-277   UniformVariable::UniformVariable(double Link Here 
271
271
272
double UniformVariable::GetValue()
272
double UniformVariable::GetValue()
273
{
273
{
274
  return Peek()->GetValue();
274
  return RandomVariable::GetValue();
275
}
275
}
276
276
277
double UniformVariable::GetValue(double s, double l)
277
double UniformVariable::GetValue(double s, double l)
 Lines 279-284   double UniformVariable::GetValue(double Link Here 
279
  return ((UniformVariableImpl*)Peek())->GetValue(s,l);
279
  return ((UniformVariableImpl*)Peek())->GetValue(s,l);
280
}
280
}
281
281
282
uint32_t UniformVariable::GetInteger (uint32_t s, uint32_t l)
283
{
284
  NS_ASSERT(s <= l);
285
  return static_cast<uint32_t>( GetValue(s, l+1) );
286
}
282
287
283
//-----------------------------------------------------------------------------
288
//-----------------------------------------------------------------------------
284
//-----------------------------------------------------------------------------
289
//-----------------------------------------------------------------------------
(-)a/src/core/random-variable.h (+9 lines)
 Lines 183-188   public: Link Here 
183
183
184
  /**
184
  /**
185
  * \brief Returns a random double with the specified range given by constructor
185
  * \brief Returns a random double with the specified range given by constructor
186
  * Required because of the second GetValue(s,l) and therefore C++ name lookup
187
  * ends in this class.
186
  * \return A floating point random value
188
  * \return A floating point random value
187
  */
189
  */
188
  double GetValue();
190
  double GetValue();
 Lines 195-200   public: Link Here 
195
  */
197
  */
196
  double GetValue(double s, double l);
198
  double GetValue(double s, double l);
197
199
200
  /**
201
   * \brief Returns a random unsigned integer from the interval [s,l] including both ends.
202
   * \param s Low end of the range
203
   * \param l High end of the range
204
   * \return A random unsigned integer value.
205
   */
206
  uint32_t GetInteger (uint32_t s, uint32_t l);
198
};
207
};
199
208
200
/**
209
/**
(-)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