adding a random tie-breaking option