Check out example codes for "java random usage". It will help you in understanding the concepts better.

Code Example 1

import java.util.Random;

Random rndm = new Random();
int mnmbr = 10;

int rndNumber = rndm.nextInt(mnumber) + 1;

System.out.println(rndNumber);

Code Example 2

import java.util.Random;

Random rand = new Random();
int maxNumber = 10;

int randomNumber = rand.nextInt(maxNumber) + 1;

System.out.println(randomNumber);

Code Example 3

int rand = ThreadLocalRandom.current().nextInt(x,y);

Learn ReactJs, React Native from akashmittal.com