random Long - Android java.util

Android examples for java.util:Random Integer

Description

random Long

Demo Code


import java.util.Random;
import android.os.SystemClock;

public class Main{
    private static final Random mRandom;
    public static long randomLong(long maximum) {
        return (long) (mRandom.nextDouble() * maximum);
    }//from   w  w  w.j  a v  a 2s  .  co m
    public static long randomLong(long minimum, long maximum) {
        return randomLong(maximum - minimum) + minimum;
    }
}

Related Tutorials