mardi 27 octobre 2015

Simulating dice rolls with RNGCryptoServiceProvider

Lets say I generated a random number using RNGCryptoServiceProvider, the minimum generation is between 0,255. now if I want to simulate a dice roll(of lets say 6 sides), I would discard any result that is over 6(and discard 0), if I do that, does the resulting number still random?(meaning will it be the same as if RNGCryptoServiceProvider was able to generate a number between 1 and 6)?

also, in general, is RNGCryptoServiceProvider good enough for dice rolls simulation? or am I better off using a service like random.org(which I have no idea how to use..)

Edit: not a duplicate, I know how to do it(I did it the same as the answer in the other question), I'm asking if doing that will still provide a random number with the same level of randomness of RNGCryptoServiceProvider.




Aucun commentaire:

Enregistrer un commentaire