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)
If integer
changes to a new random integer between 0 and 255, will this provide other "quality" floating point numbers? For instance, would requesting Uint16 for numbers between 0–65535
then let float = integer/((2**16)-1)
be a better approach just for the greater variety?
Note, my purposes for this is not for security, encryption, or cryptography. I just need the added decimal places similar to Math.random()
. I am using these numbers to plug into a normalization transform using Box Müller to create a simulated random walk.