MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / setRandomVals

Method setRandomVals

src/test/GrayscalePlotTest.java:44–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42 }
43
44 public void setRandomVals() {
45 System.out.println("GSPlotTest.setRandomVals");
46 double[][][] data=griddata.getData();
47 double[][] dataR = data[0];
48// double[][] dataG = data[1];
49// double[][] dataB = data[2];
50 double r = Math.random();
51 for(int i=0; i<numpts; i++ ) {
52 for(int j=0; j<numpts; j++ ) {
53// dataR[i][j]=255*Math.random();
54// dataG[i][j]=255*Math.random();
55// dataB[i][j]=255*Math.random();
56 dataR[i][j]=(r > 0.7 ? 255.0 * i/ numpts : r > 0.5 ? 255.0 * j /numpts : 255.0 * i/ numpts * j /numpts);
57 // green and blue are not used in this -- just amplitude (R)
58 }
59 }
60 grayscalePlot.update();
61 }
62
63
64

Callers 1

drawMethod · 0.95

Calls 3

printlnMethod · 0.65
getDataMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected