Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java randint

// In Java 1.7 or later, the standard way to do this is as follows:
import java.util.concurrent.ThreadLocalRandom;

// nextInt is normally exclusive of the top value,
// so add 1 to make it inclusive
int randomNum = ThreadLocalRandom.current().nextInt(min, max + 1);
// Example for a number dice-like output:
int randomNum = ThreadLocalRandom.current().nextInt(1, 6 + 1);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #randint
ADD COMMENT
Topic
Name
7+1 =