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

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

If the aim is to be able to use the "native" generator through the 
{{UniformRandomProvider}} API, we could implement a wrapper similar to 
[{{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]:
{code:java}
public class JDKSecureRandom extends IntProvider {
    private SecureRandom delegate;
    public class JDKSecureRandom(Long[] seed) {
        final byte[] s = NumberFactory.makeByteArray(seed);
        delegate = new SecureRandom(s);
    }
    // ... (same as in "JDKRandom")
}
{code}
where we'd use the constructor that builds the [default 
instance|https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html#SecureRandom-byte:A-]
 so that the wrapper is usable on all OSes that support the JDK.

> 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
>
> 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