MCPcopy Create free account
hub / github.com/MolinDeng/Princeton-algs4 / randomPicture

Method randomPicture

LabEnv/07Lab/SCUtility.java:19–31  ·  view source on GitHub ↗
(int width, int height)

Source from the content-addressed store, hash-verified

17
18 // create random width-by-height array of tiles
19 public static Picture randomPicture(int width, int height) {
20 Picture picture = new Picture(width, height);
21 for (int col = 0; col < width; col++) {
22 for (int row = 0; row < height; row++) {
23 int r = StdRandom.uniform(255);
24 int g = StdRandom.uniform(255);
25 int b = StdRandom.uniform(255);
26 Color color = new Color(r, g, b);
27 picture.set(col, row, color);
28 }
29 }
30 return picture;
31 }
32
33
34 public static double[][] toEnergyMatrix(SeamCarver sc) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected