-
-
Notifications
You must be signed in to change notification settings - Fork 639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimized random value generators #1700
Conversation
Current coverage is 97.03% (diff: 100%)@@ master #1700 diff @@
==========================================
Files 89 89
Lines 11264 11268 +4
Methods 0 0
Messages 0 0
Branches 1878 1876 -2
==========================================
+ Hits 10928 10934 +6
+ Misses 196 195 -1
+ Partials 140 139 -1
|
if (n <= k) { | ||
return freqGen._2; | ||
} else { | ||
n = n - k; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok for me - it is performed on a copy on the stack. Btw - when dealing with immutable objects (like in Javaslang), then nothing evil can happen at all!
@@ -424,3 +413,27 @@ | |||
return f.apply(this); | |||
} | |||
} | |||
|
|||
final class GenModule { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix that
if (n <= k) { | ||
return freqGen._2; | ||
} else { | ||
n = n - k; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Checkstyle] ERROR: Assignment of parameter 'n' is not allowed.
INFO: This PR contains a backward compatible API change: