Copilot commented on code in PR #17208:
URL: https://github.com/apache/pinot/pull/17208#discussion_r2525566321


##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/ArithmeticFunctions.java:
##########
@@ -201,6 +204,27 @@ public static double truncate(double a) {
     return Math.signum(a) * Math.floor(Math.abs(a));
   }
 
+  @ScalarFunction
+  public static double rand() {
+    return ThreadLocalRandom.current().nextDouble();
+  }
+
+  @ScalarFunction
+  public static double rand(long seed) {
+    return deterministicRand(seed);
+  }
+
+  private static double deterministicRand(long seed) {

Review Comment:
   The magic constant `0x5DEECE66DL` appears without explanation. Add a comment 
explaining its purpose in the mixing algorithm or reference the source (e.g., 
it's related to Java's Linear Congruential Generator constants).
   ```suggestion
     private static double deterministicRand(long seed) {
       // The constant 0x5DEECE66DL is the multiplier used in Java's Linear 
Congruential Generator (LCG) for java.util.Random.
       // See: https://docs.oracle.com/javase/8/docs/api/java/util/Random.html 
and OpenJDK source.
   ```



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