Need for predictable random generator

前端 未结 30 1046
情话喂你
情话喂你 2020-11-27 09:04

I\'m a web-game developer and I got a problem with random numbers. Let\'s say that a player has 20% chance to get a critical hit with his sword. That means, 1 out of 5 hits

30条回答
  •  时光取名叫无心
    2020-11-27 09:32

    How about replacing mt_rand() with something like this?

    XKCD comic (RFC 1149.5 specifies 4 as the standard IEEE-vetted random number.)

    (RFC 1149.5 specifies 4 as the standard IEEE-vetted random number.)

    From XKCD.

提交回复
热议问题