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 Herbert (Jira)" <ji...@apache.org> on 2019/09/26 16:43:00 UTC
[jira] [Resolved] (RNG-117) RandomSource to support creating byte[]
seed for implementing class.
[ https://issues.apache.org/jira/browse/RNG-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alex Herbert resolved RNG-117.
------------------------------
Fix Version/s: 1.3
Resolution: Implemented
In git master.
> RandomSource to support creating byte[] seed for implementing class.
> --------------------------------------------------------------------
>
> Key: RNG-117
> URL: https://issues.apache.org/jira/browse/RNG-117
> Project: Commons RNG
> Issue Type: Improvement
> Components: simple
> Affects Versions: 1.3
> Reporter: Alex Herbert
> Assignee: Alex Herbert
> Priority: Minor
> Fix For: 1.3
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Each implementing class represented by {{RandomSource}} has a defined seed type. The internal package knows the type and can create appropriate seeds. This occurs when a {{null}} seed is passed to the factory method {{create(RandomSource, ...)}}.
> Notably the seed generation functionality satisfies any extra requirements of the generator such as avoiding all zero bytes and, for example, low complexity bytes for the MiddleSquareWeylSequence class.
> The seed generation functionality can be exposed to allow:
> # Generation of a seed that exactly matches that generated in the factory create method
> # Generation of a seed using a user defined source of randomness
> This requires 2 new methods in RandomSource:
> {code:java}
> // To use the factory source of randomness
> public byte[] createSeed();
> // To use a user-defined source of randomness
> public byte[] createSeed(UniformRandomProvider rng);
> {code}
> This would allow separation of seed generation from RNG construction:
> {code:java}
> RandomSource source = ...;
> UniformRandomProvider rng = RandomSource.create(source);
> {code}
> Becomes
> {code:java}
> RandomSource source = ...;
> byte[] seed = source.createSeed();
> // Some later point
> UniformRandomProvider rng = RandomSource.create(source, seed);
> {code}
> An example of a user-defined source of randomness:
> {code:java}
> RandomSource source = ...;
> UniformRandomProvider seedRng = new JDKRandomWrapper(new SecureRandom());
> byte[] seed = source.createSeed(seedRng);
> UniformRandomProvider rng = RandomSource.create(source, seed);
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)