taskspaces.rna
Class Shuffler

java.lang.Object
  |
  +--taskspaces.rna.Shuffler
All Implemented Interfaces:
java.io.Serializable

public class Shuffler
extends java.lang.Object
implements java.io.Serializable

Encapsulates a method to shuffle a string using the Yates-Fischer method and a method to randomize an array of integers.

Version:
1.00
Author:
Rob Markel
See Also:
Serialized Form

Constructor Summary
Shuffler()
           
 
Method Summary
static int[] shuffleInts(int[] intArray)
          Randomly shuffles an integer array.
static java.lang.String shuffleString(java.lang.String s, int offset, int numToShuffle)
          Randomly shuffles a String using the Yates-Fischer method.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

Shuffler

public Shuffler()
Method Detail

shuffleString

public static java.lang.String shuffleString(java.lang.String s,
                                             int offset,
                                             int numToShuffle)
                                      throws java.lang.Exception
Randomly shuffles a String using the Yates-Fischer method.
Parameters:
s - String to be shuffled.
offset - index in String to begin shuffling.
numToShuffle - number of characters following offset to shuffle.
Returns:
the shuffled String.

shuffleInts

public static int[] shuffleInts(int[] intArray)
Randomly shuffles an integer array.
Parameters:
integers - the array to shuffle.
Returns:
the shuffled array.

-bottom