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

Code Example 1

// Java program to demonstrate working 
// of java.lang.Math.random() method 
import java.lang.Math; 
  
class Gfg2 { 
  
    // driver code 
    public static void main(String args[]) 
    { 
        // define the range 
        int max = 10; 
        int min = 1; 
        int range = max - min + 1; 
  
        // generate random numbers within 1 to 10 
        for (int i = 0; i < 10; i++) { 
            int rand = (int)(Math.random() * range) + min; 
  
            // Output is different everytime this code is executed 
            System.out.println(rand); 
        } 
    } 
}

Code Example 2

public static double pow(double a, double b)
Parameter:
a : this parameter is the base
b : this parameter is the exponent.
Return :
This method returns ab.

Learn ReactJs, React Native from akashmittal.com