public void shuffleRowValues ( ArrayList < String > rows ) throws Exception { doubleValues . clear ( ) ; ArrayList < String > columns = this . getColumns ( ) ; for ( String row : rows ) { ArrayList < Integer > columnIndex = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < columns . size ( ) ; i ++ ) { columnIndex . add ( i ) ; } Collections . shuffle ( columnIndex ) ; for ( int i = 0 ; i < columns . size ( ) ; i ++ ) { String column = columns . get ( i ) ; int randomIndex = columnIndex . get ( i ) ; String destinationCol = columns . get ( randomIndex ) ; String temp = this . getCell ( row , destinationCol ) ; String value = this . getCell ( row , column ) ; this . addCell ( row , destinationCol , value ) ; this . addCell ( row , column , temp ) ; } } }
Need to shuffle rows values to allow for randomized testing . The rows in the list will be shuffled together