commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-701) Seeding a default RNG
Date Fri, 04 Nov 2011 16:59:51 GMT

    [ https://issues.apache.org/jira/browse/MATH-701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144161#comment-13144161
] 

Gilles commented on MATH-701:
-----------------------------

Okay for the design discussion! ;)

But don't resolve just yet.
To avoid nasty surprises, I think that the "AbstractWell" (maybe others?) should be modified
so that default constructors are all seeded similarly.
"RandomDataImpl" as a "user" of the RNG should not have to worry how to best seed the generator.

                
> Seeding a default RNG
> ---------------------
>
>                 Key: MATH-701
>                 URL: https://issues.apache.org/jira/browse/MATH-701
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gilles
>            Assignee: Gilles
>             Fix For: 3.0
>
>
> In "RandomDataImpl":
> {code}
> private RandomGenerator getRan() {
>     if (rand == null) {
>         rand = new JDKRandomGenerator();
>         rand.setSeed(System.currentTimeMillis());
>     }
>     return rand;
> }
> {code}
> The conditional branch is used by "sample()" in "AbstractContinuousDistribution".
> When several "...Distribution" objects are instantiated in a short time interval, they
are seeded with the same value.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message