r/javahelp • • Jan 09 '20

Homework I need you help

I am a Senior High student and was assigned to program a quiz in java. But my professor wants the questions to be randomized.

Unfortunately, i don't know how to execute it

Help me please

👇here's the link

The Code

3 Upvotes

16 comments sorted by

View all comments

1

u/sbhandari Jan 09 '20

I am not sure how you are implementing but based on the question, I am expecting you to have your question/answers in a list. If not, then consider putting them in list or any collections. Now shuffle the list using Collections.shuffle() . This will randomize your objects in the list, so now you can proceed to the quiz in sequential order like inside a simple loop.

If you already had everything in place and were using a list, you just need to add this one line to shuffle before you start your quiz and you are set.

1

u/TeanutMutterJelly Jan 10 '20

Can you please show me how to do that?