RandomNumGen

Hi.

I just wanted to know, why does Panda have its own random number generator? Is it faster than the one that comes with python?

Try this:
panda3d.org/apiref.php?page=Mersenne
It’s the same algorithm that Python’s random module uses. I don’t know if its faster, though. You should try running a speed test.

I’ve also found this python-implemented class:
panda3d.org/apiref.php?page=RandomNumGen
I believe it is a wrapper around the C++ Mersenne class above.

One nice property of Panda’s Mersenne implementation is that, for a given seed value, it always generates consistent random numbers, across all platforms. This is not necessarily true of the system random number generator, and it is a particularly important property when you are developing a distributed game.

There are some other nice properties, but they’re similarly subtle. If all you want is a random number, you can use whichever random number generator you like.

David