Randomize the order of the list elements. Note that this does not obey the randomSeed() function in PApplet. @webref intlist:method @webBrief Randomize the order of the list elements
()
| 643 | * @webBrief Randomize the order of the list elements |
| 644 | */ |
| 645 | @SuppressWarnings("unused") |
| 646 | public void shuffle() { |
| 647 | Random r = new Random(); |
| 648 | int num = count; |
| 649 | while (num > 1) { |
| 650 | int value = r.nextInt(num); |
| 651 | num--; |
| 652 | long temp = data[num]; |
| 653 | data[num] = data[value]; |
| 654 | data[value] = temp; |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | |
| 659 | /** |