RFR: 8279598: Provide adapter from RandomGenerator to Random [v2]

Yasser Bazzi duke at openjdk.java.net
Fri Jan 28 00:42:10 UTC 2022


On Wed, 26 Jan 2022 17:31:27 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> Yasser Bazzi has updated the pull request incrementally with four additional commits since the last revision:
>> 
>>  - make sure setseed its initialized and throw
>>  - remove tabs
>>  - Change name of function from wrapRandom to wrap
>>  - Change variable name and wording in javadocs
>
> src/java.base/share/classes/jdk/internal/util/random/RandomWrapper.java line 41:
> 
>> 39: @SuppressWarnings("serial")
>> 40: public class RandomWrapper extends Random implements RandomGenerator {
>> 41:     private final RandomGenerator randomToWrap;
> 
> Suggest renaming the field to "generator" and replacing subsequent calls to `this.randomToWrap.foo()` with `generator.foo()`.

Changed to generator on this commit df78e05e3e692e2189c9d318fbd4892a4b96a55f

> src/java.base/share/classes/jdk/internal/util/random/RandomWrapper.java line 47:
> 
>> 45:     }
>> 46: 
>> 47:     public static Random wrapRandom(RandomGenerator random) {
> 
> Probably better if the method is just `wrap` since the class name is descriptive enough already.

Commited this change on aadef6f465c0b776f4b8025e2655110b424c6801

-------------

PR: https://git.openjdk.java.net/jdk/pull/7001


More information about the core-libs-dev mailing list