Java Random Seeds

0

Posted by admin | Posted in Uncategorized | Posted on 28-06-2009

Tags: , , , ,



java random seeds
java.util.Random?

i was wondering if someone could show me how i could generate a sequence of 30 integer numbers into an array using java.util.Random with current system time as the random seed (java.lang.System.nano.Time())
i know to to use Random() but iv never heard of using a seed
ok here’s what i came up with, all i need is a yes or no if its correct

public static void test()
{
MyVector numVec = new MyVector();

for(int i=0; i<30; ++i)
{
Random r = new Random(System.nanoTime());
int j = r.nextInt();
numVec.append(j);
}

System.out.println(numVec);
}

Yes. But you should do your own homework.

Incredible must see Minecraft seed!!!

Comments are closed.