Bug 512 - Adding UniformVariable::GetInteger and using it to fix bug in RealRandomStream::GetNext.
Adding UniformVariable::GetInteger and using it to fix bug in RealRandomStrea...
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
ns-3-dev
All All
: P1 normal
Assigned To: TimoB
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-25 07:37 EST by TimoB
Modified: 2009-03-04 13:14 EST (History)
4 users (show)

See Also:


Attachments
UniformRandomGetInteger (2.40 KB, patch)
2009-02-25 07:37 EST, TimoB
Details | Diff
fixed (1.89 KB, patch)
2009-02-25 07:43 EST, TimoB
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description TimoB 2009-02-25 07:37:11 EST
RealRandomStream::GetNext() must return backoff values for DCF in the range [0..CW] with uniform probability distribution.

A quick test showed that this is not the case. See counts of some values pulled from GetNext(0,15):

0=4786 1=9297 2=9426 3=9365 4=9283 5=9335 6=9323 7=9365 8=9312 9=9400 10=9165 11=9482 12=9236 13=9178 14=9429 15=4618 16=0 17=0 

0 and 15 are only half as probable, because round yields 0 for 0-0.5 and 1 for 0.5-1.5.

Created UniformVariable::GetInteger(min,max).

The code works if UniformVariable::GetValue(min,max) never returns max. Is this absolutely positively the case?

All regressions using DCF are messed up.
Comment 1 TimoB 2009-02-25 07:37:48 EST
Created attachment 389 [details]
UniformRandomGetInteger
Comment 2 Mathieu Lacage 2009-02-25 07:39:37 EST
If you update the patch to work with the tip of ns-3-dev, this patch looks good to me.
Comment 3 TimoB 2009-02-25 07:43:53 EST
Created attachment 390 [details]
fixed

for tip
Comment 4 Mathieu Lacage 2009-02-25 07:45:47 EST
ok for me. raj, michele, can you ack this to fix the wifi regressions ?
Comment 5 Mathieu Lacage 2009-02-25 07:46:49 EST
adding michele as CC
Comment 6 Rajib Bhattacharjea 2009-02-26 12:48:45 EST
yeah looks good.  timo, ping me before you commit.
Comment 7 TimoB 2009-03-04 13:14:52 EST
fixed 4256:cc06d903ca09