Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: rand() precision low, looking for a fast way to get high precision rand float?

by bart (Canon)
on Oct 31, 2012 at 19:53 UTC ( #1001740=note: print w/replies, xml ) Need Help??


in reply to rand() precision low, looking for a fast way to get high precision rand float?

On Windows, the random number has only 15 bits. That means that if you multiply the results with 32768, the outcome will always be an integer.

If you want something better, at least in that regard, you could pick Math::Random::MT. It's pretty fast, too.

  • Comment on Re: rand() precision low, looking for a fast way to get high precision rand float?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001740]
help
Chatterbox?
[james28909]: is there some setting i am missing?
[GrandFather]: It's either lines that your browser won't split (no white space) or nodes with <pre> tags which ought to be code tags
[GrandFather]: I haven't noticed the problem for a while, but it can be hard to find the nasty node. If you do find it, consider it and with luck a janitor will fix it

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2017-05-24 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?