mercredi 16 décembre 2015

Picking a random letter in a string

I'm trying to randomly pick three letters from a string that the user inputs and so far I have this:

    Scanner reader = new Scanner(System.in)
    String inp = reader.nextLine();
            String inputName1;
            inputName1 = inp.substring(int i = (int)(Math.random()*(inp.length()-0)+0), i+=1);

I feel like I'm missing something obvious and I'm pretty new to Java but could anyone help me with this? Thanks everybody




Aucun commentaire:

Enregistrer un commentaire