How random function works in cocos2d-x?

How random function works in cocos2d-x?
0

#1

random function works in cocos2d-x


#2

cocos2d\cocos\base\ccRandom.h

Do you ask about this?


#3

yes bro… can you explain how it works?


#4

It basically uses the c++11 random seeding.

static std::random_device seed_gen;
static std::mt19937 engine(seed_gen());

The header can give more specifics about the implementation.

https://en.cppreference.com/w/cpp/numeric/random/random_device

https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine