org.aksw.commons.collections.random
Class RandomUtils

java.lang.Object
  extended by org.aksw.commons.collections.random.RandomUtils

public class RandomUtils
extends Object

Created by Claus Stadler Date: Oct 9, 2010 Time: 5:43:50 PM


Constructor Summary
RandomUtils()
           
 
Method Summary
static
<T> T
randomItem(Collection<T> collection, Random random)
           
static
<T> T
randomItem(Iterable<T> iterable, Random random)
           
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
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomUtils

public RandomUtils()
Method Detail

shuffleRandomSample

public 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. Warning: Shuffles elements of the source list.

Type Parameters:
T -
Parameters:
source -
sampleSize -

shuffleRemoveRandomSample

public static <T> void shuffleRemoveRandomSample(List<T> source,
                                                 Collection<T> out,
                                                 int sampleSize,
                                                 Random random)

randomSampleSet

public static <T> Set<T> randomSampleSet(Collection<T> source,
                                         int sampleSize,
                                         Random random)

randomSampleSet

public static <T> Set<T> randomSampleSet(Collection<T> source,
                                         int sampleSize)

shuffleRemoveRandomSampleSet

public static <T> Set<T> shuffleRemoveRandomSampleSet(List<T> source,
                                                      int sampleSize,
                                                      Random random)

randomItem

public static <T> T randomItem(Collection<T> collection,
                               Random random)

randomItem

public static <T> T randomItem(Iterable<T> iterable,
                               Random random)


Copyright © 2011. All Rights Reserved.