Download

Use a While Loop with a random condition

Hi,

I would like to create a “While Loop” which is completed when a random integer give the good number. The number created id used as index for an boolean array where I want to find a “true” value.

My test is under :

WhileLoop.PNG

In output I set a number in array but all my number are equal to zero then I think my loop is wrong but I don’t understand why.

Thanks

Unknowns: What is the length of the TextureIsUsed array?
Your Random interger, is it set between 0 and TextureIsUsed.length-1?

This may be your problem—> Do you need the random int to be the same int for everywhere it is plugged in? (Currently, each line coming out of the random int will be a different Int, set this as a local var int and then use it several times)

Hi and thanks for you answer.

11

Yes

No, i need to test different int…

I’m not sure to understand…

Yes, it’s works. I put the random int in a variable and call this when I need !

THANKS a lot !