weighted round robin

vino via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 8 15:48:53 PDT 2016


Hi,

  Can some one guide me on how to implement the weighted round 
robin, below is what i tried or any other better ways to do it

Main Requirement : Incoming socket connection has to be sent to 3 
servers in the weighted round robin fashion.

Prog:1
import std.stdio;
import std.range;
import std.range.primitives;

void main()
{
     auto a = [1,2,3]; // E.g :Server Array
     auto b = [1,2,3,4,5]; // E.g: Socket Array
     auto r = roundRobin(a, b);
     writeln(r);
}
OUTPUT : [1, 1, 2, 2, 3, 3, 4, 5]
Requirement : [1, 1, 2, 2, 3, 3,1,4,2,5]

From,
Vino


More information about the Digitalmars-d-learn mailing list