Hello. 2019-09-20 18:45 UTC+02:00, Alex Herbert <alex.d.herb...@gmail.com>: > 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.
Perhaps better to have a code that generates a table (to be added to the userguide) with all the properties of each available "source". > > 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: +1 With "EnumSet", I guess. > > enum RandomSourceSupport { > /** The source supported the {@link JumpableUniformRandomProvider} > interface. */ > JUMPABLE, > /** The source supported the {@link LongJumpableUniformRandomProvider} > interface. */ > LONG_JUMPABLE, > } +1 > > 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. +1 Gilles > > Any other suggestions? > > Alex > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org