1
0
Fork 0
mirror of https://gitlab.com/kauron/jstudy synced 2024-07-03 08:53:01 +02:00

Test: no direct repetitions

This commit is contained in:
Carlos Galindo 2016-06-12 15:01:37 +02:00
parent 1cf4477c10
commit 3e48c5d7eb
Signed by: kauron
GPG key ID: 83E68706DEE119A3

View file

@ -69,7 +69,9 @@ public class TestController implements Initializable {
private void onSkipAction(ActionEvent event) { private void onSkipAction(ActionEvent event) {
feedback.setVisible(AppConfig.showFeedback); feedback.setVisible(AppConfig.showFeedback);
answer.setText(""); answer.setText("");
current = (int) (Math.random() * list.size()); int previous = current;
while (list.size() > 1 && current == previous)
current = (int) (Math.random() * list.size());
question.setText(list.get(current).getQuestion()); question.setText(list.get(current).getQuestion());
answer.requestFocus(); answer.requestFocus();
} }