function [indexes]=train_test_random_new(y,nmax,Vmin)
K = max(y);
% generate the  training set
indexes = [];
V = 1:K;
for i=1:length(Vmin)
    V(Vmin(i))=0;
end
V = nonzeros(V)';
for i = V
    index1 = find(y == i);
    per_index1 = randperm(length(index1));
     indexes = [indexes ;index1(per_index1(1:nmax))'];
end
for i = Vmin
    index1 = find(y == i);
    nmin = floor(length(index1)/2);
    per_index1 = randperm(length(index1));
    indexes = [indexes ;index1(per_index1(1:nmin))'];
end
indexes = indexes(:);
