Randomize the order of the list elements. Note that this does not obey the randomSeed() function in PApplet. @webref stringlist:method @brief Randomize the order of the list elements
()
| 573 | * @brief Randomize the order of the list elements |
| 574 | */ |
| 575 | public void shuffle() { |
| 576 | Random r = new Random(); |
| 577 | int num = count; |
| 578 | while (num > 1) { |
| 579 | int value = r.nextInt(num); |
| 580 | num--; |
| 581 | String temp = data[num]; |
| 582 | data[num] = data[value]; |
| 583 | data[value] = temp; |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | |
| 588 | /** |