import java.util.Random;
public   class sessionString {
    public static final void main(String[] args){
        long ctm=System.currentTimeMillis();
        System.out.println("---The Seed "+ctm);
        System.out.println("\nThe Random String "+getRandomString(ctm));
        System.out.println("\n---Using The Same Seed");
        System.out.println("\nThe Random String "+getRandomString(ctm));
        ctm=ctm+1;
        System.out.println("\n---Add 1. The Seed "+ctm);
        System.out.println("\nThe Random String "+getRandomString(ctm));
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        ctm=System.currentTimeMillis();
        System.out.println("\n---A New Seed "+ctm);
        System.out.println("\nThe Random String "+getRandomString(ctm));
    }

    public static String getRandomString(long seed){
        byte[] randbyte=new byte[10];
        Random rand  = new Random(seed);
        for (int idx = 0; idx <10; ++idx) {
            int randomInt = rand.nextInt(26); //0<=randomInt<26
            System.out.print(randomInt+" ");
            randbyte[idx]=(byte)(randomInt+65);  //"A"
        }
        try {
            return new String(randbyte, "UTF-8");
        } catch (Exception e) {
            return "bad string" ;
        }
    }
}