1) use code tags
2) follow the Sun coding standards, which you can get from Sun.
Doing both will make your code a lot easier to read and debug, as it stands I'm not even going to try.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
Use the Random Class. It's more random than Math.random();
import java.util.*;
public class RandomClassTest
{
public static void main(String[] args)
{
Random randNumGenerator = new Random();
int[] x = new int[7];
for (int i=0; i<x.length; i++)
{
x[i] = (randNumGenerator.nextInt(100)+1);
}
}
}
Be sure to add 1 if you want to reach 100.
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
Hi everyone,
Use the Random Class. It's more random than Math.random();
import java.util.*;
public class RandomClassTest
{
public static void main(String[] args)
{
Random randNumGenerator = new Random();
int[] x = new int[7];
for (int i=0; i<x.length; i++)
{
x[i] = (randNumGenerator.nextInt(100)+1);
}
}
}
Be sure to add 1 if you want to reach 100.
Could not have said it better myself
Richard West
freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10