I am making program to campare sorting algorithms.
I am using big amount of numbers. I have a performance problem in creating array full of random numbers.
Is there any way to make it faster?
Currently I am using:
int[] temp = new int[length];
for(int i = 0; i < temp.length; i++)
{
temp[i] = generator.nextInt(temp.length * 10);
}
where
generator = new Random();
If you want it faster, you may write your own random number generator,
which is less random but faster.
Unfortunatley this is c code, but you may translate to java:
Taken from http://en.wikipedia.org/wiki/Random_number_generation
For your application this will be sufficient. For crypthography not.