Here you can find the source of randomLong(long min, long max)
Parameter | Description |
---|---|
min | lower (inclusive) boundary |
max | higher (exclusive) boundary |
public static long randomLong(long min, long max)
//package com.java2s; public class Main { /**/*from w w w. j a va 2 s. com*/ * Generates pseudo-random long from specific range. Generated number is * great or equals to min parameter value and less then max parameter value. * Uses {@link Math#random()}. * * @param min lower (inclusive) boundary * @param max higher (exclusive) boundary * * @return pseudo-random value */ public static long randomLong(long min, long max) { return min + (long) (Math.random() * (max - min)); } }