I am writing a small java code to generate random values:
import java.util.Random;
public class Rann {
static Random rand;
public static void main(String args[]){
int i;
for(i=0;i<15;i++)
System.out.println(rand.nextInt(7));
}
}
This gives an error:
Exception in thread "main" java.lang.NullPointerException
at Rann.main(Rann.java:7)
Any help would be highly appreciated. And is this the preferred way to generate random values in LeJOS?