What is the best way to get a randomized real value?

In reply to prashish_143:

$urandom and $urandom_range only returns integers. If you want fractional results, you need to scale the returned value.