edu.isi.karma.modeling.semantictypes.myutils
Class RandOps
java.lang.Object
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
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RandOps
public RandOps()
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 itemsselectedList
- The list in which randomly selected items will be returnednumItems
- Number of items to be randomly selected from originallist