Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java random max and min

Random random = new Random();
int max = 10;
int min = 1;

int result = random.nextInt(max + 1 - min) + min;
Comment

maximum number from random number in java

Scanner s = new Scanner(System.in);
System.out.println("Type a number");
int n = s.nextInt();
int start = 0;
int largest = 0;
int occurrence = 0;

while(n > start){
    int number = (int)(Math.random()*100);
    if(number > largest){
        largest = number;


    }
    n--;
    System.out.print(number+" ");
}

System.out.println("max is "+largest);
System.out.println("Occurrence is "+occurrence);
Comment

maximum number from random number in java

Scanner s = new Scanner(System.in);
System.out.println("Type a number");
int n = s.nextInt();
int start = 0;
int largest = 0;
int occurrence = 0;

while(n > start){
    int number = (int)(Math.random()*100);
    if(number > largest){
        largest = number;


    }
    n--;
    System.out.print(number+" ");
}

System.out.println("max is "+largest);
System.out.println("Occurrence is "+occurrence);
Comment

PREVIOUS NEXT
Code Example
Java :: random string generator java 
Java :: spring annotations xml configuration 
Java :: spigot scheduler 
Java :: how to force garbage collection in java 
Java :: sololearn java shapes coding project 
Java :: Java android studio int to string 
Java :: java remove last character from string 
Java :: java GUI jframe text 
Java :: moving text in textview android 
Java :: keypressed java space 
Java :: How to connect java class file to xml file 
Java :: java integer to binary string 
Java :: java servlets session call 
Java :: java elapsedTime 
Java :: convert base64 to bitmap android 
Java :: floatingactionbutton image color 
Java :: how to clear stringbuilder in java 
Java :: feignException byteBuffer to string 
Java :: deque in java 
Java :: how to iterate a stack without iterator class 
Java :: make recycler view non scrollable 
Java :: get sha key android 
Java :: how to write custom message for repeat password in joi 
Java :: javafx set min window size 
Java :: character classes in regex 
Java :: sleep() java 
Java :: big integer input in java 
Java :: android java optional arguments 
Java :: how to shuffle string java 
Java :: java split on tab 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =