get Random Long - Java java.util

Java examples for java.util:Random Int

Description

get Random Long

Demo Code


//package com.java2s;

public class Main {
    public static long getRandomLong() {
        return getRandomLong(1, Long.MAX_VALUE);
    }//  w  w  w  .  jav a2s.c  o  m

    public static long getRandomLong(long min, long max) {
        return min + (long) ((Math.random() * (max - min)));
    }
}

Related Tutorials