Random.setSeed(long seed) has the following syntax.
public void setSeed(long seed)
In the following code shows how to use Random.setSeed(long seed) method.
import java.util.Random; /*w w w . j ava 2 s. c o m*/ public class Main { public static void main( String args[] ){ Random randomno = new Random(); // setting seed randomno.setSeed(20); // value after setting seed System.out.println("Object after seed: " + randomno.nextInt()); } }
The code above generates the following result.