1 Reply Latest reply: Jul 16, 2009 1:39 PM by 807588 RSS

    double to int to String

    807588
      I'm trying to get a Random number in int form (no decimals and no extra zero in front) and then add it to a String. This works, but it seems like there should be an easier way to do it:
        double d = (Math.floor(Math.random()*2));
                      int n = (int) d;           
                      Integer n2 = (Integer) n;
                      s += n2.toString();
      Any suggestions would be great.

      Thanks,
      Matt

      Edited by: Rhesus21 on Jul 16, 2009 11:33 AM