0

I'm building a relatively small Javascript Role Playing Game. As would be expected, it involves a lot of random number generation: damage rolls, to-hit rolls, ability success rolls, etc. At the moment, I'm using Javascript's native Math.random(), but from what I've heard, it's not all that random and more random alternatives exist.

Should I should bother using a non-native RNG/more obscure generation method, and if so, which one should I use?

Community
  • 1
  • 1
Hydrothermal
  • 4,851
  • 7
  • 26
  • 45
  • 2
    That would totally depend on your application's requirements. Does your application need a "more random than random" generator? The key concept here is "cryptographically strong;" if you're not dealing in encryption, you may not need such a thing. – Robert Harvey Feb 07 '14 at 17:47

1 Answers1

3

You Aren't Gonna Need It

If you're not sure you'll need a better RNG, then you probably don't need a better RNG. For your purposes, Math.random is more than good enough.

However, if you plan on calling Math.random in many different places, you might want to wrap the call in your own function. That way, if you decide you really do need a better RNG you can make the change in one location.

Eric
  • 6,965
  • 26
  • 32