jeudi 9 mars 2017

How to create two different numbers at the same time in java

I am trying to use a random number generator in java to create two different numbers simultaneously between 0 and 1 to simulate coordinates on an x ,y grid.

Random randNum = new Random();
Random randNum2 = new Random();
double x, y;

x = randNum.nextDouble();
System.out.println("from 0 to 1: " + x);

y = randNum2.nextDouble() ;
System.out.println("from 0 to 1: " + x);

Aucun commentaire:

Enregistrer un commentaire