lundi 27 juin 2016

Java and Random method

I want to create something like Flashing Light with *.
for being Flashing I decided to use "For" that Repeats 5000 times , also I want the Max * in each line be 25 but my code is not working . Does any body have any suggestion ? my code is

 void test() {

    Random rnd = new Random();
    for (int i = 0; i < 5000; i++) {
        rnd = nextInt(25);

        for (int j = 0; j < rnd; j++) {
            System.out.print(" * ");

        }

    }

}




Aucun commentaire:

Enregistrer un commentaire