Showing the changes to examples/array (2 of 5 files). Show all
Unified · Split
| @@ -23,4 +23,4 @@ fun void print_arr(int a[]) { · 22 unmodified lines | |||
| 23 | cherr <= a[i] <= " "; | 23 | cherr <= a[i] <= " "; |
| 24 | } | 24 | } |
| 25 | cherr <= IO.nl(); | 25 | cherr <= IO.nl(); |
| 26 | } | 26 | } |
| @@ -20,10 +20,10 @@ repeat( 10 ) · 19 unmodified lines | |||
| 20 | a.shuffle(); | 20 | a.shuffle(); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | // a way to do random without replacement | 23 | // one way to do random without replacement |
| 24 | repeat( 3 ) | 24 | repeat( 3 ) |
| 25 | { | 25 | { |
| 26 | cherr <= "--- random with replacment --- " <= IO.nl(); | 26 | cherr <= "--- random without replacment --- " <= IO.nl(); |
| 27 | // shuffle! | 27 | // shuffle! |
| 28 | a.shuffle(); | 28 | a.shuffle(); |
| 29 | // just go through array in order after shuffle | 29 | // just go through array in order after shuffle |