public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
copy(T orig)
Perform deep copy of an object.
|
static int[] |
selectKDistinct(int n,
int k)
Select k distinct integers from range [0, n) with reservoir sampling:
https://en.wikipedia.org/wiki/Reservoir_sampling.
|
static int[] |
selectKDistinct(int n,
int k,
Random rand)
Select k distinct integers from range [0, n) with reservoir sampling:
https://en.wikipedia.org/wiki/Reservoir_sampling.
|
public static <T> T copy(T orig)
T
- Class of original object;orig
- Original object.public static int[] selectKDistinct(int n, int k, Random rand)
n
- Number specifying left end of range of integers to pick values from.k
- Count specifying how many integers should be picked.rand
- RNG.public static int[] selectKDistinct(int n, int k)
selectKDistinct(n, k, new Random())
.n
- Number specifying left end of range of integers to pick values from.k
- Count specifying how many integers should be picked.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019