I'm relatively new to Java and a part of my homework requires that I produce a random string of 16 pairs of notes and duration.
I've looked up some examples and tried sifting through the provided materials in my class, but the results I find are either for a different programming language or for only selecting one random item in the list only.
I've defined the notes and duration as:
static char[] validNotes = {'A', 'B', 'C', 'D', 'E', 'F', 'G'};
static double[] validDuration = {0.25, 0.5, 1, 2, 4};
The expected string output would be random, but an example would be:
[A(2), G(3), B(0.5), C(1), C(1), D(0.25), …]
Aucun commentaire:
Enregistrer un commentaire