lundi 23 janvier 2017

how to get any random time between now and last three hours using Java

Can anyone please tell me how to get any random time between now and last three hours using Java

I am using Java 1.7

I have how to generate random number in simple way using java like as shown below

Random random = new Random();

 for(int i =0; i<5; i++){
      int randomInteger = random.nextInt();
      System.out.println("Random Integer in Java: " + randomInteger);
 }

But how to get any random time between now and last three hours using Java




Aucun commentaire:

Enregistrer un commentaire