Randomize master selection

Issue 10155: Option to select a random master in multi-master mode.