Shop OBEX P1 Docs P2 Docs Learn Events
Random Numbers — Parallax Forums

Random Numbers

EmilyPEmilyP Posts: 21
edited 2009-07-22 17:03 in General Discussion
Hello,

I'm coding in my JIDE right now and am testing the functionality of the Random number generator. I keep getting an error java/lang/Double was not found. So I looked and the Random package but there are no double values in it. The seed however is casts as a short.

Emily

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-07-22 16:57
    This works:

    import java.util.*;
    import stamp.core.*;
    
    public class Random_test {
    
      static void main() {
        Random myRandom = new Random();
        while (true) {
          int c = myRandom.next();
          CPU.delay(20000);
          System.out.println(c);
        }
      }
    }
    
    

    regards peter
  • EmilyPEmilyP Posts: 21
    edited 2009-07-22 17:03
    Thanks Peter. That is almost exactly my code. I've isolated the problem to the print statement, which is triggering the error.
Sign In or Register to comment.