home example philosophy documentation eclipse sources bugs

Secure Random Integer

Example benchmark to test how long it takes to generate a truely random integer:
import java.security.*;

import org.jbenchx.*;
import org.jbenchx.annotations.*;

public class Example extends Benchmark {
  private SecureRandom fRandom;

  public Example() throws Exception {
    fRandom = SecureRandom.getInstance("SHA1PRNG");
  public int random() {
    return fRandom.nextInt();