weighted round robin

Erikvv via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 12 06:44:59 PDT 2016


On Tuesday, 11 October 2016 at 06:28:10 UTC, vino wrote:
> On Monday, 10 October 2016 at 09:18:16 UTC, Marc Schütz wrote:
>>     [...]
>
> Hi Marc,
>
>  Thank you, I have made a small update as the Server Array is 
> fixed length and the Socket array would be dynamic so made the 
> below changes as now it is working as expected
> Prog:1
> import std.stdio;
> import std.range;
> import std.range.primitives;
> import std.algorithm.comparison : max;
>
> void main()
> {
>      auto a = [1,2,3]; 				     // E.g :Server Array
>      auto b = [1,2,3,4,5,6,7,8,9,10,11,12];          // E.g: 
> Socket Array
> 	 auto r = roundRobin(a.cycle, b.cycle);
> 	 writeln(r.take(max(a.length, b.length * 2)));
>  }
>
> From,
> Vino.B

In your first post you mention it should be weighted, but I see 
no weights anywhere.


More information about the Digitalmars-d-learn mailing list