mercredi 19 décembre 2018

Random / unpredictable numbers with more uniform distribution [duplicate]

This question already has an answer here:

I generate a random integer number 1-6 with a random number generator. I want to change the generation to avoid situations like this:

  • number 3 being generated 4th time in a row
  • number 2 wasn't generated in last 30 generations

So in general I want more level distribution of numbers over shorter period of time.

I'm aware that such numbers are not truly random anymore, but as long as they are unpredictable, this is fine.

It looks like a common problem. Is there any typical solution so I don't reinvent the wheel?

Code in any language is fine, but C# preferred.




Aucun commentaire:

Enregistrer un commentaire