|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.math.PersistentObject
org.apache.mahout.math.jet.random.sampling.RandomSampler
@Deprecated public class RandomSampler
Constructor Summary | |
---|---|
RandomSampler(long n,
long N,
long low,
java.util.Random randomGenerator)
Deprecated. Constructs a random sampler that computes and delivers sorted random sets in blocks. |
Method Summary | |
---|---|
void |
nextBlock(int count,
long[] values,
int fromIndex)
Deprecated. Computes the next count random numbers of the sorted random set specified on instance construction and fills them into values, starting at index fromIndex. |
protected static void |
rejectMethodD(long n,
long N,
int count,
long low,
long[] values,
int fromIndex,
java.util.Random randomGenerator)
Deprecated. Efficiently computes a sorted random set of count elements from the interval [low,low+N-1]. |
static void |
sample(long n,
long N,
int count,
long low,
long[] values,
int fromIndex,
java.util.Random randomGenerator)
Deprecated. Efficiently computes a sorted random set of count elements from the interval [low,low+N-1]. |
protected static void |
sampleMethodA(long n,
long N,
int count,
long low,
long[] values,
int fromIndex,
java.util.Random randomGenerator)
Deprecated. Computes a sorted random set of count elements from the interval [low,low+N-1]. |
protected static void |
sampleMethodD(long n,
long N,
int count,
long low,
long[] values,
int fromIndex,
java.util.Random randomGenerator)
Deprecated. Efficiently computes a sorted random set of count elements from the interval [low,low+N-1]. |
Methods inherited from class org.apache.mahout.math.PersistentObject |
---|
clone |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomSampler(long n, long N, long low, java.util.Random randomGenerator)
n
- the total number of elements to choose (must be n >= 0 and n <= N).N
- the interval to choose random numbers from is [low,low+N-1].low
- the interval to choose random numbers from is [low,low+N-1]. Hint: If
low==0, then random numbers will be drawn from the interval [0,N-1].randomGenerator
- a random number generator. Set this parameter to null to use the default random
number generator.Method Detail |
---|
public void nextBlock(int count, long[] values, int fromIndex)
Numbers are filled into the specified array starting at index fromIndex to the right. The array is returned sorted ascending in the range filled with numbers.
count
- the number of elements to be filled into values by this call (must be >= 0).values
- the array into which the random numbers are to be filled; must have a length >=
count+fromIndex.fromIndex
- the first index within values to be filled with numbers (inclusive).protected static void rejectMethodD(long n, long N, int count, long low, long[] values, int fromIndex, java.util.Random randomGenerator)
Running time is O(count), on average. Space requirements are zero.
Numbers are filled into the specified array starting at index fromIndex to the right. The array is returned sorted ascending in the range filled with numbers.
n
- the total number of elements to choose (must be >= 0).N
- the interval to choose random numbers from is [low,low+N-1].count
- the number of elements to be filled into values by this call (must be >= 0 and
<=n). Normally, you will set count=n.low
- the interval to choose random numbers from is [low,low+N-1]. Hint: If
low==0, then draws random numbers from the interval [0,N-1].values
- the array into which the random numbers are to be filled; must have a length >=
count+fromIndex.fromIndex
- the first index within values to be filled with numbers (inclusive).randomGenerator
- a random number generator.public static void sample(long n, long N, int count, long low, long[] values, int fromIndex, java.util.Random randomGenerator)
Running time is O(count), on average. Space requirements are zero.
Numbers are filled into the specified array starting at index fromIndex to the right. The array is returned sorted ascending in the range filled with numbers.
Random number generation: By default uses MersenneTwister, a very strong random number generator, much better than java.util.Random. You can also use other strong random number generators of Paul Houle's RngPack package. For example, Ranecu, Ranmar and Ranlux are strong well analyzed research grade pseudo-random number generators with known periods.
n
- the total number of elements to choose (must be n >= 0 and n <= N).N
- the interval to choose random numbers from is [low,low+N-1].count
- the number of elements to be filled into values by this call (must be >= 0 and
<=n). Normally, you will set count=n.low
- the interval to choose random numbers from is [low,low+N-1]. Hint: If
low==0, then draws random numbers from the interval [0,N-1].values
- the array into which the random numbers are to be filled; must have a length >=
count+fromIndex.fromIndex
- the first index within values to be filled with numbers (inclusive).randomGenerator
- a random number generator. Set this parameter to null to use the default random
number generator.protected static void sampleMethodA(long n, long N, int count, long low, long[] values, int fromIndex, java.util.Random randomGenerator)
Running time is O(N), on average. Space requirements are zero.
Numbers are filled into the specified array starting at index fromIndex to the right. The array is returned sorted ascending in the range filled with numbers.
n
- the total number of elements to choose (must be >= 0).N
- the interval to choose random numbers from is [low,low+N-1].count
- the number of elements to be filled into values by this call (must be >= 0 and
<=n). Normally, you will set count=n.low
- the interval to choose random numbers from is [low,low+N-1]. Hint: If
low==0, then draws random numbers from the interval [0,N-1].values
- the array into which the random numbers are to be filled; must have a length >=
count+fromIndex.fromIndex
- the first index within values to be filled with numbers (inclusive).randomGenerator
- a random number generator.protected static void sampleMethodD(long n, long N, int count, long low, long[] values, int fromIndex, java.util.Random randomGenerator)
Running time is O(count), on average. Space requirements are zero.
Numbers are filled into the specified array starting at index fromIndex to the right. The array is returned sorted ascending in the range filled with numbers.
n
- the total number of elements to choose (must be >= 0).N
- the interval to choose random numbers from is [low,low+N-1].count
- the number of elements to be filled into values by this call (must be >= 0 and
<=n). Normally, you will set count=n.low
- the interval to choose random numbers from is [low,low+N-1]. Hint: If
low==0, then draws random numbers from the interval [0,N-1].values
- the array into which the random numbers are to be filled; must have a length >=
count+fromIndex.fromIndex
- the first index within values to be filled with numbers (inclusive).randomGenerator
- a random number generator.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |