Randomize the order of the list elements. Note that this does not obey the randomSeed() function in PApplet. @webref doublelist:method @brief Randomize the order of the list elements
()
| 742 | * @brief Randomize the order of the list elements |
| 743 | */ |
| 744 | public void shuffle() { |
| 745 | Random r = new Random(); |
| 746 | int num = count; |
| 747 | while (num > 1) { |
| 748 | int value = r.nextInt(num); |
| 749 | num--; |
| 750 | double temp = data[num]; |
| 751 | data[num] = data[value]; |
| 752 | data[value] = temp; |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | |
| 757 | /** |