StepSlider rand() function
Posted: 31 Jan 2015 21:24
Maybe anyone can help me with this. I'm trying to create a Random button that sets the StepSlider to random values everytime it reaches the first step. If I use the code posted below step 13 gets value 1 and the rest of the steps gets value 0. If I change rand() to another value, like (i/16), the stepslider takes a perfect saw so the formula seems to work. Anyone have a clue how to fix this?
I've added an example with a working and a not working script.
I've added an example with a working and a not working script.
Code: Select all
decl i;
decl b=StepSlider.step;
decl length=sizeof(StepSlider.x);
if(b==0){
for(i=0; i<length; i++){
StepSlider.x[i]=rand();
}
}