About 5,700,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. java - Pick a random value from an enum? - Stack Overflow

    Then we generate a random int with max bound as the size of an array to generate a random index. Finally, after getting a random index, we access the value at that particular index from …

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

  5. java - Random number with Probabilities - Stack Overflow

    Dec 2, 2013 · I am wondering what would be the best way (e.g. in Java) to generate random numbers within a particular range where each number has a certain probability to occur or …

  6. java - Return True or False Randomly - Stack Overflow

    Jan 16, 2012 · I need to create a Java method to return true or false randomly. How can I do this?

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

  8. java - How to generate a random alpha-numeric string - Stack …

    Sep 3, 2008 · I've been looking for a simple Java algorithm to generate a pseudo-random alpha-numeric string. In my situation it would be used as a unique session/key identifier that would …

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

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