File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
src/main/java/org/codefx/demo/java17/api/random Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ private static void simpleCreation() {
37
37
// (for implemented algorithms, see Javadoc of java.util.random)
38
38
var lxm = RandomGenerator .of ("L128X128MixRandom" );
39
39
var xoshiro = RandomGenerator .of ("Xoshiro256PlusPlus" );
40
+
41
+ // even works with custom implementations by using the class' simple name
42
+ var xkcd = RandomGenerator .of ("Xkcd" );
40
43
}
41
44
42
45
private static void moreInterfaces () {
Original file line number Diff line number Diff line change 5
5
import java .util .random .RandomGenerator .ArbitrarilyJumpableGenerator ;
6
6
7
7
/*
8
- * It's possible to provide custom implementations of the generator interfaces that
9
- * get picked up by the generator factory API (including the `.of("name")` methods),
10
- * but that requires use of the JDK-internal annotation `@RandomGeneratorProperties` .
8
+ * It's possible to provide custom implementations of the generator interfaces by
9
+ * providing them as a service (see module declaration). Out of the box, that works
10
+ * with `RandomGenerator::of` (and on the other generator interfaces) .
11
11
*
12
- * While this works, the integration mechanism isn't meant for public use.
12
+ * By using the JDK-internal annotation `@RandomGeneratorProperties` (and possibly
13
+ * opening this package to java.base), it also works with `RandomGeneratorFactory`,
14
+ * but the integration mechanism isn't meant for public use.
13
15
*/
14
16
15
17
@ RandomGeneratorProperties (
You can’t perform that action at this time.
0 commit comments