Hello,
The following code show how to generate random numbers using the java.util package. This might be helpful to you. Here is the code for it
Code:
import java.util.Random;
public final class RandomInteger {
public static final void main(String... aArgs){
//note a single Random object is reused here
Random r = new Random();
for (int in = 1; in <= 10; ++in){
int rin = r.nextInt(100);
log("Generated : " + rin);
}
log("Done.");
}
private static void log(String aMessage){
System.out.println(aMessage);
}
}
Bookmarks