Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Random numbers are not random enough on Windows

by kikuchiyo (Monk)
on Oct 28, 2009 at 11:07 UTC ( #803651=note: print w/ replies, xml ) Need Help??


in reply to Random numbers are not random enough on Windows

Thanks for the answers.

I know that one shouldn't use the built-in PRNG for any 'serious' work - this is true for most programming languages, not only Perl.

There are several modules implementing 'better' PRNGs on CPAN, furthermore, Perl has interfaces for many well-known and well-tested mathemathical libraries, each having a good library of PRNG functions (GMP, PARI, GSL among others). So if I were to do any kind of serious work that involved random numbers, for example cryptography or stat.phys. simulations, I'd use one of the above.

Still, it's sad to know that the built-in generator is _this_ useless on certain platforms.


Comment on Re: Random numbers are not random enough on Windows
Re^2: Random numbers are not random enough on Windows
by BrowserUk (Pope) on Oct 28, 2009 at 13:36 UTC
    I know that one shouldn't use the built-in PRNG for any 'serious' work...

    And that's pretty much why the MS C built-in PRNG has never been improved. If they improved it sufficiently that it was no longer glaringly obvious that it is useless, then someone, and probably many someones, would try to use it for critical purposes and then blame them when it all came unravelled.

    And whilst I've never seen it written anywhere, that might also be a good reason for Perl not providing a better PRNG built-in. If it is sufficiently better to be worth while including, someone is going to assume it is sufficient for purposes for which it isn't.

    That said, it would be nice to have a good--in the simulation sense rather than the crypto sense--PRNG as a part of the core. Preferably such that if enabled through a use (or pragma), and seeded with a known value, it would produce consistant sequences across platforms. It would be a considerable boon for testing purposes.

    The MT would probably do that, but would forcing the users to explicitly select it for use be sufficient to prevent the blame game when people use it for the wrong purposes?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Why not just go around crippling all kinds of methods on Linux in addition to Windows, just so that it is painfully obvious that no one should try to do anything with any built-ins? Clearly doing a shabby job is not the answer.
        Why not

        Why? What purpose would that serve?

        just go around crippling

        Who? Me? You? MS? Everyone? Retroactively?

        all kinds of methods

        Just PRNGs? What else would you include?

        on Linux in addition to Windows

        What about Solaris? HP? z/OS?

        just so that it is painfully obvious that no one should try to do anything with any built-ins?

        are these Perl built-ins you are talking about?

        Clearly doing a shabby job is not the answer.

        "the answer" to what?

        Are you attempting to critique MS for the PRNG in their C runtimes?

        Or the Perlish authors for not correcting it?

        Or me for suggesting that maybe the MT PRNG could be added to the core; even if only as an "approved extension" if it was felt adding it as a built-in carried some kind of risk?

        You display muddy thinking, perhaps the reason you chose to post anonymously.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://803651]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2014-08-21 12:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (134 votes), past polls