Troubleshooting

StepSlider rand() function

Started by MrCorba on .

Sign in or create an account to join the conversation.

2 posts

Topic starter
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.
decl i;
decl b=StepSlider.step;
decl length=sizeof(StepSlider.x);

if(b==0){	
	for(i=0; i<length; i++){
		 StepSlider.x[i]=rand();
	}
}
Example.jzml