public class RandomSamplingAssistant extends PersistentObject
RandomSampler,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected long[] |
buffer |
protected int |
bufferPosition |
protected long |
n |
protected RandomSampler |
sampler |
protected long |
skip |
serialVersionUID| Constructor and Description |
|---|
RandomSamplingAssistant(long n,
long N,
RandomEngine randomGenerator)
Constructs a random sampler that samples n random elements from an input sequence of N elements.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Returns a deep copy of the receiver.
|
protected void |
fetchNextBlock()
Not yet commented.
|
RandomEngine |
getRandomGenerator()
Returns the used random generator.
|
static void |
main(String[] args)
Tests random sampling.
|
static int[] |
sampleArray(int n,
int[] elements)
Just shows how this class can be used; samples n elements from and int[] array.
|
boolean |
sampleNextElement()
Returns whether the next element of the input sequence shall be sampled (picked) or not.
|
static void |
test(long n,
long N)
Tests the methods of this class.
|
static void |
testArraySampling(int n,
int N)
Tests the methods of this class.
|
protected RandomSampler sampler
protected long[] buffer
protected int bufferPosition
protected long skip
protected long n
public RandomSamplingAssistant(long n,
long N,
RandomEngine randomGenerator)
n - the total number of elements to choose (must be >= 0).N - number of elements to choose from (must be >= n).randomGenerator - a random number generator. Set this parameter to null to use the default random number generator.public Object clone()
clone in class PersistentObjectprotected void fetchNextBlock()
public RandomEngine getRandomGenerator()
public static void main(String[] args)
public static int[] sampleArray(int n,
int[] elements)
public boolean sampleNextElement()
public static void test(long n,
long N)
public static void testArraySampling(int n,
int N)
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.