Android examples for java.util:Random Integer
random Long
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; } }