added algoritm to pick leader randomly