@ Override public void randomize ( int randomSeed ) { Random rand = new Random ( randomSeed ) ; for ( int j = size - 1 ; j > 0 ; j -- ) { int randIndex = rand . nextInt ( j ) ; int [ ] tmp = data [ randIndex ] ; data [ randIndex ] = data [ j ] ; data [ j ] = tmp ; int tmpl = labels [ randIndex ] ; labels [ randIndex ] = labels [ j ] ; labels [ j ] = tmpl ; float tmpw = weights [ randIndex ] ; weights [ randIndex ] = weights [ j ] ; weights [ j ] = tmpw ; } }
Randomizes the data array in place Needs to be redefined here because we need to randomize the weights as well