[ 
https://issues.apache.org/jira/browse/RNG-127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17316317#comment-17316317
 ] 

Alex Herbert commented on RNG-127:
----------------------------------

I think adding to UniformRandomProvider is noise. It could go into the 
RandomSource enum which already has isJumpable and isLongJumpable. Or the 
current API can be left clean and all the information is added to the service 
created in a dedicated JDK 17 module. That can be subject to API changes until 
the feature is in a mature JDK release. 
{quote}What would one write in order to load one of the Commons RNG's 
implementations?
{quote}
I presume it must match what is returned by the RandomGeneratorFactory name() 
method. Here is the full API for the RandomGeneratorFactory<T extends 
RandomGenerator> class:
{code:java}
// Returns a non-empty stream of available RandomGeneratorFactory(s).
static Stream<RandomGeneratorFactory<RandomGenerator>> all()
// Create an instance of RandomGenerator based on algorithm chosen.
T create()
// Create an instance of RandomGenerator based on algorithm chosen providing a 
starting byte[] seed.
T create​(byte[] seed)
// Create an instance of RandomGenerator based on algorithm chosen providing a 
starting long seed.
T create​(long seed)
// Returns the equidistribution of the algorithm.
int equidistribution()
// Returns a RandomGeneratorFactory meeting the minimal requirement of having 
an algorithm
// whose state bits are greater than or equal 64.
static RandomGeneratorFactory<RandomGenerator> getDefault()
// Return the group name of the algorithm used by the random number generator.
String group()
// Return true if random generator can jump an arbitrarily specified distant 
point in the state cycle.
boolean isArbitrarilyJumpable()
// Return true if the implementation of RandomGenerator (algorithm) has been 
marked for deprecation.
boolean isDeprecated()
// Return true if random generator uses a hardware device (HRNG) to produce 
entropic input.
boolean isHardware()
// Return true if random generator can jump a specified distant point in the 
state cycle.
boolean isJumpable()
// Return true if random generator is jumpable and can leap to a very distant 
point in the state cycle.
boolean isLeapable()
// Return true if random generator can be cloned into a separate object with 
the same properties
// but positioned further in the state cycle.
boolean isSplittable()
// Return true if random generator is computed using an arithmetic algorithm 
and is statistically deterministic.
boolean isStatistical()
// Return true if random generator is computed using external or entropic 
sources as inputs.
boolean isStochastic()
// Return true if random generator can be used to create Streams of random 
numbers.
boolean isStreamable()
// Return the name of the algorithm used by the random number generator.
String name()
// Returns a RandomGeneratorFactory that can produce instances of 
RandomGenerator that utilize the name algorithm.
static RandomGeneratorFactory<RandomGenerator> of​(String name)
// Return the period of the algorithm used by the random number generator.
BigInteger period()
// Returns number of bits used by the algorithm to maintain state of seed.
int stateBits()
{code}
At present the JDK 17 EA and the openjdk source on github do not have the 
java.util.random package. So we will have to wait for a release to be made 
before knowing exactly how to integrate with the code.

> Assess future compatibility with JEP 356: Enhanced Pseudo-Random Number 
> Generators 
> -----------------------------------------------------------------------------------
>
>                 Key: RNG-127
>                 URL: https://issues.apache.org/jira/browse/RNG-127
>             Project: Commons RNG
>          Issue Type: Task
>          Components: client-api
>    Affects Versions: 1.3
>            Reporter: Alex Herbert
>            Priority: Minor
>
> JEP 356 specifies an enhancement to the random number generators. This is 
> targeted to JDK 17.
> [JEP 356: Enhanced Pseudo-Random Number 
> Generators|https://openjdk.java.net/jeps/356]
> The enhancement will add interfaces to the JDK for random number generation:
>  * SplittableRandomGenerator extends RandomGenerator and also provides
>  methods named split and splits. Splittability allows the user to spawn a new 
> RandomGenerator from an existing RandomGenerator that will generally produce 
> statistically independent results.
>  * JumpableRandomGenerator extends RandomGenerator and also provides
>  methods named jump and jumps. Jumpability allows a user to jump ahead a 
> moderate number of draws.
>  * LeapableRandomGenerator extends RandomGenerator and also provides
>  methods named leap and leaps. Leapability allows a user to jump ahead a 
> large number of draws.
>  * ArbitrarilyJumpableRandomGenerator extends LeapableRandomGenerator and 
> also provides additional variations of jump and jumps that allow an arbitrary 
> jump distance to be specified.
> The specification describes the development of abstract classes that would 
> allow different algorithms to be easily implemented by developers and used 
> with a Java application through a common interface. This would replicate the 
> functionality of the Common RNG API and core modules within the JDK.
> The JDK interfaces should be compared with the current client API in Commons 
> RNG with the aim to assess:
>  # Compatibility
>  # Potential to back-port functionality
> JEP 356 also mentions the implementation of the LXM family of RNGs and a 
> change to the algorithm used by SplittableRandom to address two weaknesses 
> identified in 2016. These could be included in the current codebase pending 
> license compatibility checks.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to