--- a/src/policies/DIF/RMT/MaxQueue/REDDropper/REDDropper.cc
+++ b/src/policies/DIF/RMT/MaxQueue/REDDropper/REDDropper.cc
@@ -1,5 +1,5 @@
//
-// Copyright © 2014 PRISTINE Consortium (http://ict-pristine.eu)
+// Copyright © 2014 - 2015 PRISTINE Consortium (http://ict-pristine.eu)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
@@ -78,7 +78,16 @@
{
monitor->qCounters[queue] += 1;
const double pb = maxP * (avr - minThresh) / (maxThresh - minThresh);
- const double pa = pb / (1 - count * pb);
+ double pa;
+ if ((count * pb) < 1)
+ {
+ pa = pb / (1 - (count * pb));
+ }
+ else
+ {
+ pa = 1.0;
+ }
+
const double rand = dblrand();
if (rand < pa)