
If (((_ok)? true: (Math.random()  0.1))) {return res;} - neo2001
https://github.com/mongodb/mongo-java-driver/blob/1d2e6faa80aeb5287a26d0348f18f4b51d566759/src/main/com/mongodb/ConnectionStatus.java#L213
======
infogulch
The code in question is:

    
    
                } catch (Exception e) {
                    if (!((_ok) ? true : (Math.random() > 0.1))) {
                        return res;
                    }
                    (error logging)
                    _ok = false;
                }
    

A 10% percent chance to skip logging under certain circumstances. Very strange
code, and a strange way to write it. Also wouldn't this be equivalent to

    
    
        if (!_ok || (Math.random() > 0.1))

~~~
y_
[http://stackoverflow.com/questions/16833100/why-does-the-
mon...](http://stackoverflow.com/questions/16833100/why-does-the-mongodb-java-
driver-use-a-random-number-generator-in-a-conditional)

~~~
infogulch
Well that should be the article link. That's a good answer too.

