From e9243520e4dae7cc8e8d67657418537bef2a8776 Mon Sep 17 00:00:00 2001 From: Carlos Galindo Date: Mon, 19 Jun 2017 14:30:04 +0200 Subject: [PATCH] TestController: while to do-while --- src/main/java/es/kauron/jstudy/controller/TestController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/es/kauron/jstudy/controller/TestController.java b/src/main/java/es/kauron/jstudy/controller/TestController.java index 43ef6c9..e958620 100644 --- a/src/main/java/es/kauron/jstudy/controller/TestController.java +++ b/src/main/java/es/kauron/jstudy/controller/TestController.java @@ -75,8 +75,9 @@ public class TestController implements Initializable { private void onSkipAction(ActionEvent event) { answer.setText(""); int previous = current; - while (list.size() > 1 && current == previous) + do current = (int) (Math.random() * list.size()); + while (list.size() > 1 && current == previous); question.setText(list.get(current).getQuestion()); answer.requestFocus(); }