There is no perfect solution to it. I was just looking for ideas.
One possible approach (which is actually used in some networks) is to
elect the mode with lowest/highest ip/number as the leader.
Usually the most popular choice is to have all of the nodes send out a
message (with timestamp) at random intervals and the one who was first
(earliest timestamp) is chosen as the leader. The process is repeated
in case of a collision. The essence being that there has to be an
element of randomness when otherwise all the nodes are identical in
performance.
Regards,
Jyoti