how generate a random number in java between 3 and 5

Solutions on MaxInterview for how generate a random number in java between 3 and 5 by the best coders in the world

showing results for - "how generate a random number in java between 3 and 5"
Luca
27 Jan 2020
1/* First Method */
2int random = (int) (Math.random() * 100 + 1); /* Random number between 1 and 100*/
3int random = (int) (Math.random() * 65 + 1); /* Random number between 1 and 65*/
4/* Second Method */
5import java.util.Random;
6Random randnumber = new Random();
7int number = randnumber.nextInt(100); /* between 1 and 100*/
8system.out.println(number);
Andrea
24 Feb 2018
1public int getRandomNumber(int min, int max) {
2    return (int) ((Math.random() * (max - min)) + min);
3}
queries leading to this page
random number between 1 and 10 in javagenerate 5 random bumbers javajava random number between 1 and 100java random number between 1 and 1java random number between and within 1 and 100how to get a random number between 1 and 10 in javagenerate random number between 0 and 3 javagenerate random number java between 1 and 10java generate random numbers between 1 and 10java random number between 1 10 and 10java random between 10 and 10java generate random number between 1 and 10java random from 1 to 1generate a random number from 1 to 4 in javagenerate random number between 0 and 9 in javarandom java from 10 to 10random 1 10 javajava random integer between 20 and 100returns a random integer from 1 to 10 javajava random number between 1 and 2random check from 1 to 10 javahow to generate random number between 0 and 1 in javahow to generate random number between 1 to 5 in javajava random from 1 to 3random number from 1 to 10 javarandom number between 0 and 100 in javarandom number between 1 and 7 javahow generate a random number in java between 3 and 5java generate random number between 1 and 100how to generate a random number from 1 to 100 in javajava random number generator between 1 and 10how to use math random in java using 3 numbersjava random 1 to 10how to generate random number between 1 and 100 in javajava random from 1 to 10random number between 0 and 2 javajava random number between 1 and 100generate a random number in java between 1 and 100java random number between 100 and 1000generate 10 random numbers in javagenerate random number in java between 1 to 1000java random number between 1 and 10generate random number in java between 1 and 10java random integer between 1 and 3random number generator 1 3 javahow to generate a random number in java between 1 and 100how to generate a random number in java between 1 and 10java generate random number between 0 and 1random number between 1 and 3 javarandom number 0 5 to 1 javagenerate random number 1 to 6 in javaget a random number either 0 or 1 in javajava random number between 10 and 10java random between 1 and 10generate a random number in java between 1 and 10random number generator 1 100 javarandom values form 10 to 100 javarandom two number in java 8random java da 1 and 10random number java between 0 and 1random number generator 1 2 javajava random number between 1000 and 9999generate a random integer between 3 and 5 javahow to generate a random number between 0 and 1 in javarandom number between 0 and 9 javarandom number between 1 and 20 javarandom number java between 1 and 10generate random number java between 0 and 1random number from 1 100 in javajava random integer between 1 and 10java random number between 10 and 50java random int between 1 and 10random number between 0 and 1 javarandom 1 3d 2 javajava random number betweenrandom number between 0 and 100 javagenerate random number javabetween 1 and 10random number between 1 and 10 javajava random number between 5 and 10java create random number between 1 and 100random number 1 to 10 in javarandom between 0 and 1 javajava random int between 1 and 100how to generate random number between 1 and 1 in javarandom numbers between 0 to 100 in javagenerate random number between 10 and 20 javajava random number between 1 and 10 lbraryhow to generate 3 random numbers in javajava get random number between 1 and 10java random between 10 and 50java generate random number from 1 to 100how to generate 3 random different numbers in javarandom number java between 1 and 100random number between 0 and 10 javajava random number 1 to 4java program to generate random number between 1 and 10how to create a random number in java between 2 and 5generate random number in java between 1 to 10random java 1 10how to get random numbers between 3 to 3 in javause random in java between 1 and 10generate random double java between 1 and 1java random between 0 and 10random number generator java 1 10java generate 10 different random numbersgenerate random number between 1 to 5 in javagenerate random number between 1 and 10 javajava random from 1 10java random int between 0 and 1java random numbers between 1 and 100random 1 to 10 javahow to generate 5 random numbers in javarandom in java on the basis of a numberjava 8 get random number between 1 and 10random number java 0 or 1java random number between and with 1 and 100random 10 number generator javajava random number between 0 and 1java generate random numbers between 0 and 100java ganerate random number 1 to 10java random value between 0 and 1java random num between 1 and 10 java random number between 1000 and 10000how to create a random number generator 1 100000 javajava random number between 0 and 9java code random number generator between 1 and 6generate 4 random numbers in javajava random number between 1 and 20java generate random number between 100 and 500java random number 1 to 10random java 1 and 1how to get a random number from 1 to 6 in javagenerate 3 different random numbers javajava generate random integer between 0 and 256random number between 1 and 100 javajava generate random int between 1 and 100java generate random numbers between 1 and 20generate integer random number in java between 1 to 10generate random number 1 to 100 javahow to generate random between 1 and 1 in javahow to generate a random number in java 1 to 10 with 33 25 probabilityjava random number between 1 and 3java random integer between 1 and 30java random number between 100 and 100java random number between 2 valueshow to generate a random number in java between 5 and 10java random integer between 1 and 100how to get a random number in java between 0 and 1math random 1 to 10 javarandom integer java between 1 and 10java make 3 random numbershow to generate a random number between 10 and 20 in javarandom number guesser code between 1 and 10 in javajava random number between 0 and 10java get random between 1 and 2random number between 1 and 10 java math randomjava how to generate a random number between 1 and 10random from 1 to 10 with new random javajava random number between 1 and 0print a random number between 1 and 12 javarandom 10 10 javahow generate a random number in java between 3 and 5