Matthew Brown wrote:Do you have a Math class of your own hanging around? That's one possible cause. The compiler could be trying to use that instead of java.lang.Math, and if your class doesn't have a random() method it will fail with that error.
there was a Math.class in the classes folder. deleted it and got it working. thank you
Campbell Ritchie wrote:Probably better to work out how to use a java.util.Random object. It’s much more versatile than Math.random().
But if you do, watch out for the same problem again since you've got a Random class!
(It's generally a good idea to avoid having classes with the same name as core Java classes, especially commonly used ones.)