Shuffling elements within rows of a 2D array (JAVA)

How would I shuffle the elements within the rows of a 2D array such that if I had:

{{'a', 'b', 'c', 'd'}, {'e', 'f', 'g'}, {'h', 'i','j','k'}

it would turn to something like:

{{'d', 'b', 'a', 'c'}, {'g', 'f', 'e'}, {'i', 'j','k','h'}

Basically, how do I get each 1D array in a 2D array to shuffle its elements?

Please help - I'm not sure how to start!



Read more here: https://stackoverflow.com/questions/68462075/shuffling-elements-within-rows-of-a-2d-array-java

Content Attribution

This content was originally published by A E at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: