how insert unique random values without repitation in vector in java?

i want to create vector of big length of unique random values.

Random rand = new Random();

Vector randomProjection = new Vector(100);

for(int d=0; d<100; d++) {

double val =Math.abs(rand.nextGaussian());

double h= (double) ((double) Math.round(val*10)/10.0);

randomProjection.set(d, h);


but the randomProjection vector contain duplicate values when i think to use set insert random values in it then insert from set to vector but set contain only some values not all 100 values ....

Read More »

By: StackOverFlow - Sunday, 15 April

Related Posts