MCPcopy
hub / github.com/careercup/ctci / shuffle

Method shuffle

java/Chapter 8/Question8_8/Automator.java:35–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33 }
34
35 public void shuffle() {
36 for (int i = 0; i < remainingMoves.size(); i++) {
37 int t = AssortedMethods.randomIntInRange(i, remainingMoves.size() - 1);
38 Location other = remainingMoves.get(t);
39 Location current = remainingMoves.get(i);
40 remainingMoves.set(t, current);
41 remainingMoves.set(i, other);
42 }
43 }
44
45 public void removeLocation(int r, int c) {
46 for (int i = 0; i < remainingMoves.size(); i++) {

Callers 1

playRandomMethod · 0.95

Calls 4

randomIntInRangeMethod · 0.95
sizeMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected