On Wed, Oct 29, 2008 at 1:49 PM, Colin Allinson <[EMAIL PROTECTED]> wrote:
> I have a list of 10 servers and a public routine that dispatches work to > them. The code tries each server in turn until it finds one that can > respond. > > I now want to randomly distribute the workload across the 10 servers so I > want to be able to sort the list into random order. I still want to try > all 10 servers once only until I find one that responds. It is fairly easy > to randomise the starting point and then go through them in sequence but I > cannot think how to sort the list itself into random sequence. Use the "random" stage to come up with random numbers, and prefix your data records with them and sort: \ var list | split | s: spec stop anyeof select 1 1.4 c2d 1.10 r select 0 1-* n | sort | substr 11-* \ random 100 | s: I hope this is not distributing over virtual machines, because then you should consider not keep all servers moderately busy but run just as many as you need (to let the rest sleep). Rob
