What is the correct code for getting a realy random sublist (with size X) of a List with Integers? {1,2,5,7,12,18,71,72,73} -> get a sublist e.g with 4 items ->Result: {1,5,71,73}
I was trying to solve it with Random.nextInt
, but as my first list is not in a row, it's not possible.
What would be the correct solution?