About 57 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 ...

    Java 7+ In Java 1.7 or later, the standard way to do this (generate a basic non-cryptographically secure random integer in the range [min, max]) is as follows:

  3. 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 nextInt(), nextFloat(), …

  4. java - How can I generate a random number without use of …

    10 My project entails that I create a basic number guessing game that uses the JOptionPane and does not use Math.Random to create the random value. How would you go about doing this? I've …

  5. import java.util.Random does not exist - Stack Overflow

    Feb 15, 2014 · New on Eclipse and learning the Java basics. I'm fond of PHP so I don't really have problems with the syntax, but when I try to use rand = new Random, the Random goes red even if I …

  6. "import java.util.*; or import java.util.random;" - Stack Overflow

    Feb 2, 2020 · Random is not a 'util', and neither is anything else imported by the import statement. The word is 'class'.

  7. Generating a Random Number between 1 and 10 Java

    26 This will work for generating a number 1 - 10. Make sure you import Random at the top of your code.

  8. java - ¿Como generar números aleatorios dentro de un rango de …

    Mar 8, 2016 · 15 En Java existen dos clases principales para generar números aleatorios: java.util.Random java.security.SecureRandom La función Math.random() usa java.util.Random por si …

  9. Java Generate Random Number Between Two Given Values

    Mar 11, 2011 · Java doesn't have a Random generator between two values in the same way that Python does. It actually only takes one value in to generate the Random. What you need to do, then, is add …

  10. Using import java.util.Random; nextInt and user input

    Feb 28, 2017 · I am fairly new to java so this will probably seem like a basic question. I am trying to use the random java.util and nextInt to create a random number in a range specified by user input and …