Randomize the order of the list elements. Note that this does not obey the randomSeed() function in PApplet. @webref intlist:method @brief Randomize the order of the list elements
()
| 698 | * @brief Randomize the order of the list elements |
| 699 | */ |
| 700 | public void shuffle() { |
| 701 | Random r = new Random(); |
| 702 | int num = count; |
| 703 | while (num > 1) { |
| 704 | int value = r.nextInt(num); |
| 705 | num--; |
| 706 | long temp = data[num]; |
| 707 | data[num] = data[value]; |
| 708 | data[value] = temp; |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | |
| 713 | /** |