Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Round robin processing

by llarochelle (Beadle)
on Sep 09, 2019 at 17:17 UTC ( [id://11105895]=note: print w/replies, xml ) Need Help??


in reply to Re: Round robin processing
in thread Round robin processing

Thanks for those ideas. That's interesting, I thought about modulo but wasn't sure how to use it , because remainder is often 0 : e.g. : 8%1 , 8%2, 8%4 all have a remainder of 0.

Replies are listed 'Best First'.
Re^3: Round robin processing
by jcb (Parson) on Sep 09, 2019 at 17:26 UTC

    The remainder being 0 is not really a problem and is needed for the solutions presented thus far, because all of them are using arrays to store the bins instead of using a hash. Arrays in Perl are indexed using numbers starting at 0, so it "just fits" and also mean that the bins are always in a known order instead of the random order that your initial code produces.

Re^3: Round robin processing
by bliako (Monsignor) on Sep 10, 2019 at 15:31 UTC

    those with a remainder of 0 will go to bin 0, i.e. the first slot in the bins array.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105895]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-18 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found