Random: nextLong() : Random « java.util « Java by API






Random: nextLong()

      

import java.util.Random;

public class Main {
  public static void main(String[] args) {
    Random rand = new Random();
    int randomInt = rand.nextInt(10);
    long randomLong = rand.nextLong() * 10;
    float randomFloat = rand.nextLong() * 10;
    double randomDouble = rand.nextDouble() * 10;
  }
}

   
    
    
    
    
    
  








Related examples in the same category

1.new Random(int intValue)
2.Random: nextInt()
3.Random: nextDouble
4.Random: nextGaussian()
5.Vector: removeElementAt(int index)