00001 #include "Headers.h"
00002 #include "ModelBandwidthPareto.h"
00003 #include "Rand.h"
00004
00005 CModelBandwidthPareto::CModelBandwidthPareto(
00006 __bitrate min,
00007 __bitrate max,
00008 double alpha,
00009 __bitrate unit
00010 )
00011 {
00012 this->min = min;
00013 this->max = max;
00014 this->alpha = 1 - alpha;
00015 this->unit = unit;
00016 }
00017
00018 double CModelBandwidthPareto::Bandwidth(unsigned int peer)
00019 {
00020 return this->unit * ceil(pow(CRand::Generate() * (pow(this->max, this->alpha) - pow(this->min, this->alpha)) + pow(this->min, this->alpha), 1.0 / this->alpha) /
00021 this->unit);
00022 }