Does this function rightly shuffle the first elements of a list into the whole list? [on hold]

50
June 13, 2019, at 10:50 AM

I would like to transform a list partially shuffled (the first elements are not shuffled) into a fully shuffled list, I came up with this method, but I'm not sure that it produces a balanced shuffle, so the question is: is it the right way to do that?

public static <T extends List<?>,RandomAcess> void shuffleRandomAcess(T list,final int excludedMaxIndexToShuffleIn, Random rnd)
{
    final int size = list.size();
    for(int i = 0; i < excludedMaxIndexToShuffleIn; i ++)
    {
        java.util.Collections.swap(list, i, i + rnd.nextInt(size-i));
    }
}

Assuming that list is an ArrayList containing: {a,b,c,e1,e2,e3,e4} where the 3 first elements are ordered, and the 4 last elements are already rightly shuffled, does this call: shuffleRandomAcess(list ,3, rnd) produces an ArrayList contaning all the elements rightly shuffeled? or are some element sequences more likely to hapen than others?

READ ALSO
Getting the max occurences of each individual number from a HashMap&lt;Integer, List&lt;Integer&gt;&gt;

Getting the max occurences of each individual number from a HashMap<Integer, List<Integer>>

I've been dealing with an exercise, in which I have to find a solution for the following problem: I have a

18
How to Read Specific Range value of an Object Property

How to Read Specific Range value of an Object Property

i'm new dealing with Ontologies and finding problems to get my GraphQL Query working , trying to read value of specific Object property that has multiple Ranges Object Property Screenshot

52
Unable to establish connection to unix server using Jsch and private key

Unable to establish connection to unix server using Jsch and private key

I am trying to establish a connection to a Unix server and put/get files using SFTPI am using JCraft's Jsch 0

32
Implementing a proper C# event (not delegate) in java

Implementing a proper C# event (not delegate) in java

As already mentioned in this SO answer and the other posts in the same question, C# delegates can be implemented using interfaces or Java FuncationInterfaces

34