dimitrisdimas1313 dimitrisdimas1313 - 8 months ago 65
Java Question

MersenneTwister random number generator

I have a list(with 100.000 data) and i want to choose 4000 of them using MersenneTwister. I also want to use current system time because i run 15 times the program and i need different number of times.

MersenneTwister mt = new MersenneTwister("current system function");
for(int i=0; i<4000; i++){

I think that i must write something like this but i dont know which current system function to use to take different numbers

pjs pjs
Answer Source

Use the no-argument form of the constructor. Quoting the javadocs at Apache Commons, "The instance is initialized using the current time plus the system identity hash code of this instance as the seed." Thus each run will produce different results.