Assume integer
below is produced by a true random number generator, and the number changes randomly between 0
and 255
.
let integer = 241 // true random number
For the application I'm working on, I need to convert that number into a floating decimal between 0
and 1
to look more like the result from Math.random()
.
So,
let float = integer/(2**8)-1
Then, for my question, given the initial random number integer
am I reducing its randomness if I do this?
let random = float * Math.random() * Math.random() * Math.random()
Note, my purposes for this is not for security, encryption, or cryptography. I just need the added decimal places Math.random()
three times adds.
Aucun commentaire:
Enregistrer un commentaire