public final class RandomNumbers extends Object
BiasedNumbers
Constructor and Description |
---|
RandomNumbers() |
Modifier and Type | Method and Description |
---|---|
static long |
nextLong(Random rnd,
long n)
Similar to
Random.nextInt(int) , but returns a long between
0 (inclusive) and n (exclusive). |
static int |
randomIntBetween(Random r,
int min,
int max)
A random integer between
min (inclusive) and max (inclusive). |
static long |
randomLongBetween(Random r,
long min,
long max)
A random long between
min (inclusive) and max (inclusive). |
public static int randomIntBetween(Random r, int min, int max)
min
(inclusive) and max
(inclusive).public static long randomLongBetween(Random r, long min, long max)
min
(inclusive) and max
(inclusive).public static long nextLong(Random rnd, long n)
Random.nextInt(int)
, but returns a long between
0 (inclusive) and n
(exclusive).rnd
- Random generator.n
- the bound on the random number to be returned. Must be
positive.Copyright © 2011–2023 Carrot Search s.c.. All rights reserved.