Hi all, i'm trying to control a randomSeed() parameter with a slider to create a random number that i can use again in a running sketch, i'm having problems to change the randomSeed, it always get stucked, if i comment the line 31( "sliderValue= int(random(10));") it runs ok, but of course i don't have the random, here's the sketch:
import controlP5.*;
ControlP5 cp5;
//int sliderValue;
int caos, sliderValue;
color myColor;
void setup() {
size(700, 400);
noStroke();
cp5 = new ControlP5(this);
cp5.addSlider("sliderValue")
.setPosition(100, 50)
.setRange(0, 10)
.setNumberOfTickMarks(10)
;
cp5.addSlider("caos")
.setPosition(100, 100)
.setRange(0, 10)
.setNumberOfTickMarks(10)
;
}
void draw() {
background(0);
randomSeed(caos);
sliderValue= int(random(10));
fill(map(sliderValue, 0, 10, 0, 255));
rect(0, 0, width, 100);
println("SLIDER VALUE", sliderValue);
println("CAOS", caos);
}
void slider(float theColor) {
myColor = color(theColor);
println("a slider event. setting background to "+theColor);
}