public class RandomUtils extends Object
| Constructor and Description |
|---|
RandomUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
randomItem(Collection<T> collection,
Random random) |
static <T> T |
randomItem(Iterable<T> iterable,
Random random) |
static <T> T[] |
randomSample(T[] universe,
int n)
Returns a random sample of the given universe.
|
static <T> Set<T> |
randomSampleSet(Collection<T> source,
int sampleSize) |
static <T> Set<T> |
randomSampleSet(Collection<T> source,
int sampleSize,
Random random) |
static <T> void |
retainRandomSample(List<T> inout,
int sampleSize,
Random random) |
static <T> void |
shuffleRandomSample(List<T> source,
Collection<T> out,
int sampleSize,
Random random)
Extracts a random sample of a specified maximum size from the given collection.
|
static <T> void |
shuffleRemoveRandomSample(List<T> source,
Collection<T> out,
int sampleSize,
Random random) |
static <T> Set<T> |
shuffleRemoveRandomSampleSet(List<T> source,
int sampleSize,
Random random) |
public static <T> T[] randomSample(T[] universe,
int n)
public static <T> void shuffleRandomSample(List<T> source, Collection<T> out, int sampleSize, Random random)
T - source - sampleSize - public static <T> void shuffleRemoveRandomSample(List<T> source, Collection<T> out, int sampleSize, Random random)
public static <T> void retainRandomSample(List<T> inout, int sampleSize, Random random)
public static <T> Set<T> randomSampleSet(Collection<T> source, int sampleSize, Random random)
public static <T> Set<T> randomSampleSet(Collection<T> source, int sampleSize)
public static <T> Set<T> shuffleRemoveRandomSampleSet(List<T> source, int sampleSize, Random random)
public static <T> T randomItem(Collection<T> collection, Random random)
Copyright © 2015. All rights reserved.