Why does the MongoDB Java driver use a random number generator in a conditional?

I saw the following code in this commit for MongoDB’s Java Connection driver, and it appears at first to be a joke of some sort. What does the following code do?

if (!((_ok) ? true : (Math.random() > 0.1))) {
    return res;
}

(EDIT: the code has been updated since posting this question)

4 Answers
4

Leave a Comment