stevesketch
5/9/2016 - 8:44 AM

#Random_And_Noise

// function to call for float

float wiggle(float freq, float amp,int seed, int oct) {
  float output;
  float noisey;
  float f = frameCount*0.01;
 
  noiseDetail(oct);
  noiseSeed(seed);
  if (seed % 2 == 0 ) {
    noisey = (noise(f,f)-0.5)*2;
    output = ((sin(f*freq)*noisey)*amp);
  } else {
    noisey = (noise(f,f)-0.5)*2;
    output = ((sin(f*freq)*-noisey)*amp);
  }
  return output;
}
Layer 1 - GausianBlur
Duplicate Layer
Layer 2 - GausianBlur*3
Layer 2 - Subtract mode
Merge Layers
Exposure up
import java.util.Random;

/**
 * Returns a pseudo-random number between min and max, inclusive.
 * The difference between min and max can be at most
 * <code>Integer.MAX_VALUE - 1</code>.
 *
 * @param min Minimum value
 * @param max Maximum value.  Must be greater than min.
 * @return Integer between min and max, inclusive.
 * @see java.util.Random#nextInt(int)
 */
public static int randInt(int min, int max) {

    Random rand;

    // nextInt is normally exclusive of the top value,
    // so add 1 to make it inclusive
    int randomNum = rand.nextInt((max - min) + 1) + min;

    return randomNum;
}

PVector randomInTri(PVector A, PVector B, PVector C) {
  float r1 = random(1);
  float r2 = random(1);
    float x = (1 - sqrt(r1)) * A.x + (sqrt(r1) * (1 - r2)) * B.x + (sqrt(r1) * r2) * C.x;
  float y = (1 - sqrt(r1)) * A.y + (sqrt(r1) * (1 - r2)) * B.y + (sqrt(r1) * r2) * C.y;
  return new PVector(x, y);
}
// call with randomInCirc(circlecenterx, circlecentery, diameter)

PVector randomInCirc(float cx, float cy, float d) {
  d/=4;
  float t = TWO_PI*random(d);
  float u = random(d)+random(d);
  d = (u>1) ? 2-u : u;
  return new PVector(cx+d*cos(t), cy+d*sin(t));
}
int diceRoll = ceil(random(3));
switch (diceRoll) {
  case 1:
  break;
  case 2:
  break;
  case 3:
  break;
}