vendredi 9 octobre 2020

Number generator side by side

i have a simple question: i have this number generator that gives me 20 random numbers one below the other. But I want the last 10 numbers side by side to the top 10 numbers (and not among each other). And the numbers should be separated by a ; sign. (something like that:
0,26842 ; 0,57317

0,26841 ; 0,68413

0,98147 ; 0,39874

.....

import java.util.Random;
public class generator{

    public static void main(String []args){

    for(int i=0; i<10; i++ ){
      double random1 = 0.001 + Math.random() * (0.999 - 0.001);
      double random = 0.001 + Math.random() * (0.999 - 0.001);
      System.out.println(random1);
      System.out.println(random);
    }
}
}



Aucun commentaire:

Enregistrer un commentaire