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

Gilles commented on RNG-19:
---------------------------

I'm now wondering whether we should prefer this:
{code:java}
public final class JDKRandomWrapper extends IntProvider {
    // ...
}
{code}
with the same implementation as 
[{{JDKRandom}}|https://gitbox.apache.org/repos/asf?p=commons-rng.git;a=blob;f=commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/JDKRandom.java].
 This entails fuller integration within the "Commons RNG" framework (derived 
types generation, cache, save/restore) and would make it the complement of 
[{{JDKRandomBridge}}|https://gitbox.apache.org/repos/asf?p=commons-rng.git;a=blob;f=commons-rng-simple/src/main/java/org/apache/commons/rng/simple/JDKRandomBridge.java]:
 * {{JDKRandomBridge}}:
 ** Source of randomness = Commons RNG
 ** API (and functionality) = JDK
 * {{JDKRandomWrapper}}:
 ** Source of randomness = JDK
 ** API (and functionality) = Commons RNG

Of course, in that case, some of the tested expectations will not pass, e.g. a 
"wrapped" instance will not produce the same derived types as a non-wrapped 
one. [Maybe "Wrapper" is not the appropriate name.]
 Also, users should be warned that the wrapped object should not be accessed 
otherwise (e.g. after restore, the "delegate" will be a different object); 
recommended usage pattern would be, for example:
{code:java}
UniformRandomProvider rng = new 
JDKRandomWrapper(SecureRandom.getInstance("NativePRNGNonBlocking"));
{code}

> System generator (/dev/random)
> ------------------------------
>
>                 Key: RNG-19
>                 URL: https://issues.apache.org/jira/browse/RNG-19
>             Project: Commons RNG
>          Issue Type: Wish
>            Reporter: Emmanuel Bourg
>            Priority: Minor
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Commons RNG could include a random number generator based on the output of 
> /dev/random or /dev/urandom on Unix systems.
> Commons Crypto has an implementation that could be used as a starting point:
> https://github.com/apache/commons-crypto/blob/master/src/main/java/org/apache/commons/crypto/random/OsCryptoRandom.java



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to