Advertisement
xeromino

example

Jun 12th, 2014
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1.  for (int i=0; i<num; i++) {
  2.       for (int j=0; j<num; j++) {
  3.     float r = random(1); // this will get you a number between 0.0 and 0.9999999etc
  4.         if (r<0.2) { // if the random numbers happens to be between 0.0 and 0.19999 the fill will be some color (with a transparency of 150)
  5.         fill(255,128,0,150);
  6.     } else {  // if the random numbers happens to be between 0.2 and 0.99999 the fill will be red (with a transparency of 150)
  7.         fill(255,0,0,150);
  8.   }
  9.         rect(gap * (i+1) + cellsize * i + random(-10,10), gap * (j+1) + cellsize * j + random(-10,10), cellsize, cellsize);
  10.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement