edu.isi.karma.modeling.semantictypes.myutils
Class RandOps

java.lang.Object
  extended by edu.isi.karma.modeling.semantictypes.myutils.RandOps

public class RandOps
extends java.lang.Object

This class provides utility methods for performing randomness based operations, such as, generating random numbers within a range.

Author:
amangoel

Constructor Summary
RandOps()
           
 
Method Summary
static
<T> void
getRandomlySelectedItemsFromList(java.util.List<T> originalList, java.util.List<T> selectedList, int numItems)
           
static void main(java.lang.String[] args)
           
static java.util.ArrayList<java.lang.Integer> uniqSortedRandNums(int limit, int nNumbers)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandOps

public RandOps()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

uniqSortedRandNums

public static java.util.ArrayList<java.lang.Integer> uniqSortedRandNums(int limit,
                                                                        int nNumbers)
Parameters:
limit - Max limit. Numbers will be returned from 0 (inclusive) and limit (exclusive)
nNumbers - Number of random numbers to be returned (cannot be greater than limit)
Returns:
A list of integers randomly selected within the above mentioned limit

getRandomlySelectedItemsFromList

public static <T> void getRandomlySelectedItemsFromList(java.util.List<T> originalList,
                                                        java.util.List<T> selectedList,
                                                        int numItems)
Type Parameters:
T - The type of the lists
Parameters:
originalList - The original list containing all the items
selectedList - The list in which randomly selected items will be returned
numItems - Number of items to be randomly selected from originallist