audun commented on issue #673: Replace instances of Math.random with 
Random.nextDouble
URL: https://github.com/apache/lucene-solr/pull/673#issuecomment-491580285
 
 
   Creating a new instance of Random and calling nextDouble on it once? What 
about the overhead of `new Random();`?
   
   Math.random is initialized once and reuses it, though shares it between 
threads so it needs to be synchronized.
   
   > This method is properly synchronized to allow correct use by more than one 
thread. However, if many threads need to generate pseudorandom numbers at a 
great rate, it may reduce contention for each thread to have its own 
pseudorandom-number generator.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to