public class Knuth extends Object
Knuth
class provides a client for reading in a
sequence of strings and shuffling them using the Knuth (or FisherYates)
shuffling algorithm. This algorithm guarantees to rearrange the
elements in uniformly random order, under
the assumption that Math.random() generates independent and
uniformly distributed numbers between 0 and 1.
For additional documentation,
see Section 1.1 of
Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
See StdRandom
for versions that shuffle arrays and
subarrays of objects, doubles, and ints.
Modifier and Type  Method and Description 

static void 
main(String[] args)
Reads in a sequence of strings from standard input, shuffles
them, and prints out the results.

static void 
shuffle(Object[] a)
Rearranges an array of objects in uniformly random order
(under the assumption that
Math.random() generates independent
and uniformly distributed numbers between 0 and 1). 
static void 
shuffleAlternate(Object[] a)
Rearranges an array of objects in uniformly random order
(under the assumption that
Math.random() generates independent
and uniformly distributed numbers between 0 and 1). 
public static void shuffle(Object[] a)
Math.random()
generates independent
and uniformly distributed numbers between 0 and 1).a
 the array to be shuffledpublic static void shuffleAlternate(Object[] a)
Math.random()
generates independent
and uniformly distributed numbers between 0 and 1).a
 the array to be shuffledpublic static void main(String[] args)
args
 the commandline arguments