How to use random(T min, T max);

Continuing the discussion from Cocos2d-x v3.11 released!:

This should be a new topic as the question is not specific to Cocos2d-x v3.11

Oh,
function random(T min, T max) still work in 3.10
Sound like a lots of function change in 3.11

Hi windbk
I suggest you to use these functions:

RandomHelper::random_int (T min, T max)
RandomHelper::random_real(T min, T max)

Bye

Thanks drakon99,
It’s not work!

What’s the problem?
What version of cocos2d-x are you using?

I use 3.11 . #include <spine/spine-cocos2dx.h> error too.

Sound like 3.11 has some update. You can see that we didn’t need #include “cocos2d.h” anymore.``

Hi
I’m using cocos2d-x 3.11 too and the RandomHeper class seem to work well! :smile:
You need only this include:

#include "cocos2d.h"
USING_NS_CC; // to use namespace 'cocos2d'

If you are not using Spine, you can delete the inclusion of related headers from your project!

Bye

Oh, I need to use spine too. Did you try spine yet?

Anyway, You can delete the #include “cocos2d.h” in 3.11. No need that line.

Sorry, I never used Spine inside cocos2d-x.
Very likely the problem is that your project is not correctly configured.
Probably you have to add the Spine header folder inside the “header search paths”.
How this has to be made depends of the kind of your project (Linux, iOS, Android).

Good luck