About 8,520,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 one) in the …

  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 al método …

  4. Generating Unique Random Numbers in Java - Stack Overflow

    74 With Java 8+ you can use the ints method of Random to get an IntStream of random values then distinct and limit to reduce the stream to a number of unique random values.

  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 between zero …

  6. Java generating non-repeating random numbers - Stack Overflow

    I want to create a set of random numbers without duplicates in Java. For example I have an array to store 10,000 random integers from 0 to 9999. Here is what I have so far: import java.util.Rand...

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

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

  9. How would you give random limits in java? - Stack Overflow

    Jan 18, 2012 · So let's say you want to generate a random number, but you want it to be UNDER a specified amount. Is this possible?

  10. True random generation in Java - Stack Overflow

    I was reading the Math.random() javadoc and saw that random is only psuedorandom. Is there a library (specifically java) that generates random numbers according to random variables like environm...