Skip to content

Commit ba2138f

Browse files
committed
more shuffles
1 parent 16a31fb commit ba2138f

File tree

1 file changed

+3
-2
lines changed
  • Chapter10/random-numbers/src

1 file changed

+3
-2
lines changed

Chapter10/random-numbers/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ mod tests {
4848
let chosen = emoji.choose_multiple(&mut rng, 3);
4949
assert_eq!(chosen, ['😱', '🙃', '😭']);
5050

51-
let mut three_wise_monkeys = vec!['🙈', '🙉', '🙊'];
51+
let mut three_wise_monkeys = vec!['🙈','🙉', '🙊'];
5252
three_wise_monkeys.shuffle(&mut rng);
53-
assert_eq!(three_wise_monkeys, ['🙈', '🙉', '🙊']);
53+
three_wise_monkeys.shuffle(&mut rng); // in this case, the first time won't change anything
54+
assert_eq!(three_wise_monkeys, ['🙈', '🙊', '🙉']);
5455

5556
let mut three_wise_monkeys = vec!['🙈', '🙉', '🙊'];
5657
let partial = three_wise_monkeys.partial_shuffle(&mut rng, 2);

0 commit comments

Comments
 (0)