RFR: 8279598: Provide adapter from RandomGenerator to Random
Yasser Bazzi
duke at openjdk.java.net
Wed Jan 26 00:52:57 UTC 2022
Hi, could i get a review on this implementation proposed by Stuart Marks, i decided to use the https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/random/RandomGenerator.html interface to create the default method `asRandom()` that wraps around the newer algorithms to be used on classes that do not accept the new interface.
Some things to note as proposed by the bug report, the protected method next(int bits) is not overrided and setSeed() method if left blank up to discussion on what to do with it.
Small test done on https://gist.github.com/YShow/da678561419cda8e32fccf3a27a649d4
-------------
Commit messages:
- No need to synchronize setSeed nextGaussian
- No need to synchronize setSeed
- Fix whitespace and tab
- Rewrite javadoc
- Add copyright notice
- Make use of the new wrapper function
- Add static method to create wrapper
- implement RandomGenerator interface
- Fix imports
- Create asRandom() method in RandomGenerator
- ... and 1 more: https://git.openjdk.java.net/jdk/compare/d47af74e...fbdf4969
Changes: https://git.openjdk.java.net/jdk/pull/7001/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7001&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8279598
Stats: 171 lines in 2 files changed: 171 ins; 0 del; 0 mod
Patch: https://git.openjdk.java.net/jdk/pull/7001.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/7001/head:pull/7001
PR: https://git.openjdk.java.net/jdk/pull/7001
More information about the core-libs-dev
mailing list