randomRange() never return the maximum value of range


I am trying to generate a random value in range 0.00 and 0.09 using the cc.math.randomRange() method. However, for some reason, the value the method return, never go above 0.06, I need to set the maximum value to 0.15 to force it to go up to 0.09. But obviously it is not optimal as if the method return any value above 0.09, it would be invalid in my app.

Not sure why is this happening. is there any better solution to this?

Thank you.

It works on my machine.
I think I need more information

1 Like

@ddabrahim What version of Creator are you using? What are the reproduce steps? Did you get an error? Can you provide a demo that reproduces the problem?

My apology.

It is indeed return 0.09 but I am not getting the result I am expecting and assumed without testing it is return 0.06 but that is not the case, it is return 0.09 yet I get the result for 0.06. I`ll open a separate topic to explain in more detail what is happening.

Thank you.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.