SecureRandom.setSeed(long seed) has the following syntax.
public void setSeed(long seed)
In the following code shows how to use SecureRandom.setSeed(long seed) method.
/* w w w . j a v a2 s. co m*/ import java.security.SecureRandom; public class Main { public static void main(String args[]) throws Exception { SecureRandom ran = SecureRandom.getInstance("SHA1PRNG", "SUN"); ran.setSeed(101L); ran.setSeed(101L); byte[] seeds = ran.getSeed(24); for (int i = 0; i < seeds.length; i++) { System.out.println("Seed[" + i + "]:" + seeds[i]); } } }
The code above generates the following result.