Which random number generator does Unity use?

Pretty simple question. Which random number generator does Unity use for its Random class? I am working on a project and really don’t want to implement a 64 bit mersenne twister in java script if I don’t have to. =P

I tried doing some searches but only found answers for how to use the generator, not what was running it on the back end. Anyone happen to know?

Hi, welcome to the forum!

Unity uses Marsaglia’s Xorshift 128 algorithm. Check out the Wikipedia page for theory, links and sample code.

1 Like

Yay! Not subtractive!

Thank you very much for the info, it helps me greatly.