dimanche 21 novembre 2021

How to random string based on user input in Java? [duplicate]

How do I random a string if the user input 5 names and I need to choose one randomly. Here is my code

    System.out.println("Type 5 names: ");

    for (int num=0; num < 5; num++){
        String[] names = {input.next()};
    }

    Random rand = new Random();



Aucun commentaire:

Enregistrer un commentaire