kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919830477


##########
server/src/main/java/org/apache/uniffle/server/LocalStorageChecker.java:
##########
@@ -156,8 +156,7 @@ boolean checkStorageReadAndWrite() {
         if (!writeFile.createNewFile()) {
           return false;
         }
-        byte[] data = new byte[1024];
-        new Random().nextBytes(data);
+        byte[] data = RandomUtils.nextBytes(1024);

Review Comment:
   > This code creates a java.util.Random object, uses it to generate one 
random number, and then discards the Random object. This produces mediocre 
quality random numbers and is inefficient.
   
   Replacing it by `RandomUtils` is a choice made by me. It's also OK to store 
the Random object in a field, and reuse it every time.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to