I have read about many random number generators and all problems that most have (repeatable, non-uniform distribution, floating-point precision, modulus w/e).
I'm a game developer and I'm thinking why not generate 'random' numbers from time ? I know they won't be 'random', but at least they can't be predicted and I'm only happy for them to just feel random for the players.
For example let's say, at every frame we can take 5 digits out of the current time and use them to generate random numbers. Let's say if we have the time as a float ss.mmmuuunnn where ss = seconds, mmm = miliseconds, uuu = microseconds and nnn = nanoseconds, we can take only the part muuun and use this to generate our very own random numbers. I have investigated them a bit, and they seem and feel pretty random. I can come up with so many formulas to play around with those 5 digits and get new numbers.
Anyone here seeing anything wrong or that can perform miserably ? Reminder, I'm just looking for an easy way to generate numbers that 'FEEL' randomly distributed and are unpredictable.
Is this an easy and decent way to give players the sense of randomness ?
Aucun commentaire:
Enregistrer un commentaire