Created
April 8, 2016 19:37
-
-
Save emopers/da9b78139a4237c4cb200c063da30805 to your computer and use it in GitHub Desktop.
Improve random number generation to reduce contention
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In TraceCreator.java, Math.random() is used for random number generation. | |
According to Java API (Link: http://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#random--), | |
it's suggested that each thread has their own random number generator to reduce contention. | |
This pull request improved the condition by replacing Math.random() with Random.nextInt(). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment