Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import java.util.Random;

public class Main {
public static void main(String args[]){
public static void main(String args[]){ //main method
Random_clas random_g = new Random_clas(); //created an object of class Random_class
random_g.random_method(); //using the object to refrence the random_method



}
}

class Random_class{
public void random_method(){
int[] numbers = new int[]{5,4,8,9,6,3,7,4,2,85,63,45,10};
Random random = new Random();
int ranNum = random.nextInt(numbers.length-1);
Random random = new Random(); //new object of class Random
int ranNum = random.nextInt(numbers.length-1); //Length of the Array -1
int a = numbers[ranNum];
System.out.print("Your generated random number is: " + a);

System.out.print("Your generated random number is: " + a);
}
}