Example usage for org.apache.commons.math.random RandomDataImpl setSecureAlgorithm

List of usage examples for org.apache.commons.math.random RandomDataImpl setSecureAlgorithm

Introduction

In this page you can find the example usage for org.apache.commons.math.random RandomDataImpl setSecureAlgorithm.

Prototype

public void setSecureAlgorithm(String algorithm, String provider)
        throws NoSuchAlgorithmException, NoSuchProviderException 

Source Link

Document

Sets the PRNG algorithm for the underlying SecureRandom instance using the Security Provider API.

Usage

From source file:org.qnot.passtab.TabulaRecta.java

public void generate() {
    RandomDataImpl rand = new RandomDataImpl();
    try {//from w  w  w.  jav a 2 s  .c  om
        rand.setSecureAlgorithm("SHA1PRNG", "SUN");
    } catch (NoSuchProviderException e) {
        throw new RuntimeException("Failed to set secure provider", e);
    } catch (NoSuchAlgorithmException e) {
        throw new RuntimeException("Failed to set secure algorithm", e);
    }

    for (int i = 0; i < this.headerAlphabet.size(); i++) {
        tabulaRecta[i] = generateRow(i, rand);
    }
}