About 55 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. java - ¿Como generar números aleatorios dentro de un rango de …

    Mar 8, 2016 · 1 Se puede utilizar el método nextInt(bound) de java.util.Random. Este método genera un número aleatorio dentro del intervalo abierto entre 0 inclusivo y el número pasado …

  4. Generating a Random Number between 1 and 10 Java

    I want to generate a number between 1 and 10 in Java. Here is what I tried: Random rn = new Random(); int answer = rn.nextInt(10) + 1; Is there a way to tell what to put in the parenthesis …

  5. Generating Unique Random Numbers in Java - Stack Overflow

    2 I have come here from another question, which has been duplicate of this question (Generating unique random number in java) Store 1 to 100 numbers in an Array. Generate random number …

  6. Java random numbers using a seed - Stack Overflow

    Sep 17, 2012 · This is my code to generate random numbers using a seed as an argument: double randomGenerator(long seed) { Random generator = new Random(seed); double num …

  7. Get random boolean in Java - Stack Overflow

    Jul 13, 2012 · Java 8: Use random generator isolated to the current thread: ThreadLocalRandom nextBoolean () Like the global Random generator used by the Math class, a …

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

  9. Java: random long number in 0 <= x < n range - Stack Overflow

    Random class has a method to generate random int in a given range. For example: Random r = new Random(); int x = r.nextInt(100); This would generate an int number more or equal to 0 …

  10. java - Случайные числа - Stack Overflow на русском

    Jan 28, 2011 · import java.util.Random; // Инициализируем генератор Random rnd = new Random(System.currentTimeMillis()); // Получаем случайное число в диапазоне от min до …