private HashSet<Integer> selectSample(Hashtable<Integer,List<Integer>> coi, int sampleRate){

        HashSet<Integer> res = new HashSet<Integer>();

        List<Integer> lst_aux = new ArrayList<Integer>();

        Enumeration<Integer> e = coi.keys();
        while(e.hasMoreElements()){
            lst_aux.add(e.nextElement());
        }

        int size = lst_aux.size();
        float sample = (float)size*(float)sampleRate/(float)100;

        Random r = new Random();

        int index;
        while(res.size() < sample && lst_aux.size() != 0){
            index = r.nextInt(lst_aux.size());
            int objIndex = lst_aux.get(index);

            int containsPairedIndex = containsPairedIndex(res, coi.get(objIndex));

            if(!res.contains(objIndex) && containsPairedIndex != -1){
                res.add(objIndex);
                res.add(containsPairedIndex);
                lst_aux.remove(index);
            }
            else if(res.contains(objIndex) && containsPairedIndex != -1){
                res.add(containsPairedIndex);
            }
            else if(!res.contains(objIndex) && containsPairedIndex == -1){
                res.add(objIndex);
                lst_aux.remove(index);
            }

        }

        return res;
    }