How to make crypto.randomBytes() to replace Math.random()

I need a cryptographically secure random number generator to replace Math.random()

I came across crypto.randomBytes() however, it returns a byte array. What is a way to make the byte array into 0-1 ( so that it is compatible with Math.random)

You could do something like:

var randomVal = (crypto.randomBytes(1)[0] / 255);