You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex D Herbert (Jira)" <ji...@apache.org> on 2019/09/25 11:31:00 UTC

[jira] [Commented] (RNG-116) RandomSource to expose supported functionality and seed size

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

Alex D Herbert commented on RNG-116:
------------------------------------

Exposure of the number of bytes required for a RandomSource may result in user generation of unsuitable seeds for the implementing class, e.g. by randomly creating a {{byte[]}} seed.

One example is the MiddleSquareWeylSequence generator that requires a high complexity increment for the Weyl sequence. Constructing this generator with zero bits for the increment will result in a broken generator.

The method to return the seed byte size will be removed from this ticket. A new ticket covering the use cases for seed generation has been created.

See RNG-117.



> 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
>          Time Spent: 50m
>  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)