Java SecureRandom.generateSeed(int numBytes)

Syntax

SecureRandom.generateSeed(int numBytes) has the following syntax.

public byte[] generateSeed(int numBytes)

Example

In the following code shows how to use SecureRandom.generateSeed(int numBytes) method.


//from w ww  . ja va 2s  .c  o  m
import java.security.SecureRandom;
import java.util.Arrays;

public class Main {
  public static void main(String[] argv) throws Exception {
    SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");

    System.out.println(Arrays.toString(sr.generateSeed(8)));
  }
}




















Home »
  Java Tutorial »
    java.security »




SecureRandom