About 711,000 results
Open links in new tab
  1. how to use math.pi in java - Stack Overflow

    Sep 26, 2012 · how to use math.pi in java Asked 13 years, 1 month ago Modified 6 years, 1 month ago Viewed 582k times

  2. How do I generate random integers within a specific range in Java ...

    With Java 8 they introduced the method ints(int randomNumberOrigin, int randomNumberBound) in the Random class. For example if you want to generate five random integers (or a single …

  3. Getting random numbers in Java - Stack Overflow

    I would like to get a random value between 1 to 50 in Java. How may I do that with the help of Math.random();? How do I bound the values that Math.random() returns?

  4. Should I import a math library, and if so how? - Stack Overflow

    Feb 23, 2014 · E and PI are not functions, they're static fields (data members). That code will output their values correctly. You don't have to import anything, the Math class is in the …

  5. java - Math.random () explanation - Stack Overflow

    Nov 1, 2011 · This is a pretty simple Java (though probably applicable to all programming) question: Math.random() returns a number between zero and one. If I want to return an integer …

  6. Why can't my program access the math methods in Java?

    May 22, 2013 · If a file is called Math.java (which it seems to be), it must contain a class called Math. Take a look at this post. Java is looking for a file called ./Math.java, which doesn't …

  7. How do you use math.random to generate random ints?

    Dec 23, 2011 · Please remove the import statement importing java.util package. then your program will use random() method for java.lang by default and then your program will work. …

  8. java - Math.random () v/s Random class - Stack Overflow

    The Math class in Java has a method, Math.random() which returns a pseudorandom number between 0 and 1. There is also a class java.util.Random which has various methods like …

  9. what is the difference between the java.lang.Math class and the …

    A package is a place where many class files go. A class has two names. One simple name, Math, and one qualified name with the package as a suffix, java.lang.Math. This makes it possible for …

  10. How to round a number to n decimal places in Java

    Sep 30, 2008 · Most of this are already in Java, with NumberFormat class. Use the factory method, like NumberFormat nf = NumberFormat.getNumberInstance(); and you can use it for …