I have added some new sections to the user guide for new additions to the library.

Currently the section on JumpableUniformRandomProvider gives an example:

RandomSource source = RandomSource.XO_RO_SHI_RO_128_SS; // Known to be jumpable.
JumpableUniformRandomProvider master = (JumpableUniformRandomProvider) 
RandomSource.create(source);

It then states:

"In the above example, the source is known to implement the JumpableUniformRandomProvider interface. Not all generators support this functionality."

There is currently no way to know if a generator is jumpable without first creating it and using 'instanceof':

RandomSource source = RandomSource.XO_RO_SHI_RO_128_SS; // Known to be jumpable.
UniformRandomProvider master = RandomSource.create(source);
if (master instanceof JumpableUniformRandomProvider) {
    // go ahead ...
}

This should be improved but how?

Currently not all providers have this functionality. This could be handled with a soft option of adding it only to javadoc or an option to add it to the API:

1. Add a note to the RandomSource javadoc for each generator that is a JumpableUniformRandomProvider and LongJumpableUniformRandomProvider. This is manageable for now but may not be if more and more selective features are added later.

2. Add a method BitSet<T> getSupport() to the RandomSource enum, where T is an enum that can be expanded as more features are added. Initially is would be:

enum RandomSourceSupport {
    /** The source supported the {@link JumpableUniformRandomProvider} 
interface. */
    JUMPABLE,
    /** The source supported the {@link LongJumpableUniformRandomProvider} 
interface. */
    LONG_JUMPABLE,
}

Currently the RandomSource only has a isNativeSeed(Object) method. So adding methods does add API clutter. It would be possible to also add getNativeSeedLength() method as this information (available in the javadoc) is now available in the factory code that builds generators.

Any other suggestions?

Alex


Reply via email to