alex at tweedly.net
Fri Apr 17 13:14:29 EDT 2020
Or to do the full distribution ...
put Njobs div Ndrivers into tMin
put NJobs mod Ndrivers into tExtras
repeat with i = 1 to NDrivers
if i <= tExtras then
However, say your drivers are sorted alphabetically, then before long
Andy will realise that he is being allocated more jobs that Zebedee. You
could (sometimes) reverse the order of drivers - but then Mary loses out
on jobs compared to both Andy and Zebedee. Or you could randomize the
order of the drivers - but maybe they're also pre-sorted by location.
Instead, you want to even out the spread of extras across the drivers -
so you need something like
repeat with i = 1 to Ndrivers
if tExtras > (Ndrivers-i)/2 then
subtract 1 from tExtras
(which still has a slight bias towards giving jobs to Zebedee - but it's
so slight it will take probably take him years to notice :-)
On 17/04/2020 05:28, Jerry Jensen via use-livecode wrote:
> Hi Skip,
> Forgive me if this is not the answer you seek, or an oversimplification, but there is an easy way to find if the jobs can be exactly evenly distributed, with nothing left over:
> if (tjobs mod tdrivers) = 0 then // it is evenly distrutable.
>> On Apr 16, 2020, at 7:41 PM, Skip Kimpel via use-livecode <use-livecode at lists.runrev.com> wrote:
>> I have working on creating a loop that would divide the number of jobs by
>> the number of users and then checking to see to see if it is evenly
>> divisible but that is kind of where I am stuck. Everything I have tried
>> thus far has proven to be unsuccessful.
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode