replaced unused long[] version of shuffle with an Object[] version.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@764 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2002-05-29 18:00:04 +00:00
parent 51eb070a53
commit 1d41ce55a5
@@ -1,5 +1,5 @@
// //
// $Id: ArrayUtil.java,v 1.4 2002/05/29 00:08:17 shaper Exp $ // $Id: ArrayUtil.java,v 1.5 2002/05/29 18:00:04 ray Exp $
// //
// samskivert library - useful routines for java programs // samskivert library - useful routines for java programs
// Copyright (C) 2001 Walter Korman // Copyright (C) 2001 Walter Korman
@@ -96,7 +96,7 @@ public class ArrayUtil
* *
* @param values the array to shuffle. * @param values the array to shuffle.
*/ */
public static void shuffle (long[] values) public static void shuffle (Object[] values)
{ {
shuffle(values, 0, values.length); shuffle(values, 0, values.length);
} }
@@ -109,14 +109,14 @@ public class ArrayUtil
* @param offset the index at which to start shuffling elements. * @param offset the index at which to start shuffling elements.
* @param length the number of elements to shuffle. * @param length the number of elements to shuffle.
*/ */
public static void shuffle (long[] values, int offset, int length) public static void shuffle (Object[] values, int offset, int length)
{ {
// starting from the end of the specified region, repeatedly swap // starting from the end of the specified region, repeatedly swap
// the element in question with a random element previous to it // the element in question with a random element previous to it
// (in the specified region) up to and including itself // (in the specified region) up to and including itself
for (int ii = offset + length - 1; ii > offset; ii--) { for (int ii = offset + length - 1; ii > offset; ii--) {
int idx = offset + _rnd.nextInt(ii - offset + 1); int idx = offset + _rnd.nextInt(ii - offset + 1);
long tmp = values[ii]; Object tmp = values[ii];
values[ii] = values[idx]; values[ii] = values[idx];
values[idx] = tmp; values[idx] = tmp;
} }