[ 
https://issues.apache.org/jira/browse/RNG-116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alex D Herbert resolved RNG-116.
--------------------------------
    Fix Version/s: 1.3
       Resolution: Implemented

In git master.

> RandomSource to expose supported functionality and seed size
> ------------------------------------------------------------
>
>                 Key: RNG-116
>                 URL: https://issues.apache.org/jira/browse/RNG-116
>             Project: Commons RNG
>          Issue Type: Improvement
>          Components: simple
>    Affects Versions: 1.3
>            Reporter: Alex D Herbert
>            Assignee: Alex D Herbert
>            Priority: Minor
>             Fix For: 1.3
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> h2. Interface support
> The {{RandomSource}} can be used to created instances that may implement 
> {{JumpableUniformRandomProvider}}. This requires casting the returned value 
> from the {{create}} method. Add methods to expose the interfaces supported by 
> the provider without instantiation.
> {code:java}
> public boolean isJumpable();
> public boolean isLongJumpable();
> {code}
> This will allow:
> {code:java}
> RandomSource source = ...;
> if (source.isJumpable()) {
>     JumpableUniformRandomProvider rng =
>         (JumpableUniformRandomProvider) RandomSource.create(source);
> }
> {code}
> h2. Seed size
> The internal components used to build the generators by RandomSource know the 
> size of the seed required for the constructor. This can be exposed in a 
> method:
> {code:java}
> public int getSeedByteSize();
> {code}
> This will allow:
> {code:java}
> RandomSource source = ...;
> SecureRandom sr = new SecureRandom();
> UniformRandomProvider rng = RandomSource.create(source,
>     sr.generateSeed(source.getSeedByteSize()));
> {code}



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

Reply via email to