About 50 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: import …

  3. Generating a Random Number between 1 and 10 Java

    This will work for generating a number 1 - 10. Make sure you import Random at the top of your code. import java.util.Random; If you want to test it out try something like this. Random rn = …

  4. Generating Unique Random Numbers in Java - Stack Overflow

    This is the most simple method to generate unique random values in a range or from an array. In this example, I will be using a predefined array but you can adapt this method to generate …

  5. Java random number with given length - Stack Overflow

    Mar 22, 2011 · I need to genarate a random number with exactly 6 digits in Java. I know i could loop 6 times over a randomizer but is there a nother way to do this in the standard Java SE?

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

  7. Java random numbers using a seed - Stack Overflow

    Sep 17, 2012 · 65 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 …

  8. Get random numbers in a specific range in java - Stack Overflow

    Jul 31, 2012 · Possible Duplicate: Java: generating random number in a range I want to generate random numbers using java.util.Random(arg); The only problem is, the method can only take …

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

  10. True random generation in Java - Stack Overflow

    To generate a “true” random number, the computer measures some type of physical phenomenon that takes place outside of the computer. For a more day-to-day example, the computer could …