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

Gilles commented on MATH-899:
-----------------------------

I'm no expert in thread-safety but ...

bq. The part of the next(int bytes) method that uses mti [...]

... I don't think so; or more exactly, it can be that synchronization of the 
whole method is more than strictly necessary, or that it should be refactored 
into blocks of statements that must be synchronized and blocks that don't need 
to.
I think that it is one of the important collateral issues about making a code 
thread-safe: not overdoing it to avoid too much efficiency loss.

bq. For now we could also document in the class javadoc whether an 
implementation is thread-safe or not

To do that is a huge effort. For now, users must assume that no class (except 
immutable ones) is thread-safe.

                
> A random crash of MersenneTwister random generator
> --------------------------------------------------
>
>                 Key: MATH-899
>                 URL: https://issues.apache.org/jira/browse/MATH-899
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>         Environment: Windows 7, JDK 1.7.05
>            Reporter: Alexander Nozik
>            Priority: Minor
>
> There is a very small probability that MersenneTwister generator gives a 
> following error: 
> java.lang.ArrayIndexOutOfBoundsException: 624
> in MersenneTwister.java line 253
> The error is completely random and its probability is about 1e-8.
> UPD: The problem most probably arises only in multy-thread mode.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to