About 712,000 results
Open links in new tab
  1. 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?

  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. 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, 2 months ago Viewed 582k times

  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 · Delete the file Math.java that you have probably inadvertently left in your source code directory. This file is preventing the normal usage of JDK's java.lang.Math class. You …

  7. Is there a method that calculates a factorial in Java?

    May 21, 2009 · In fact, the value of 20! is the largest one can represent in a Java long. So the following method will either calculate factorial (n) or throw an IllegalArgumentException if n is …

  8. math - Calculate Average Java - Stack Overflow

    Nov 11, 2014 · I'm trying to calculate the average of the student scores and as it stands I'm struggling with the calculation part. In my assignment I was asked to caulculate the avg age of …

  9. 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 …

  10. 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 …