[Insight-users] about MersenneTwisterRandomVariateGenerator

Kris Zygmunt krismz at sci.utah.edu
Mon Mar 28 12:18:40 EDT 2011


Hi Gaëtan,
I ran an experiment calling the non-thread-safe version that is in ITK  
from multiple threads and had long strings of 0 when I was trying to  
get a uniform distribution of integers.  96% of 1,000,000 draws were  
0.  I switched to using your version and saw a very nice looking  
distribution instead.

Does anyone know why the ITK version's New() operator is returning a  
singleton?  Will your version, which basically eliminates the  
singleton and makes one of the set seed methods thread-safe be  
incorporated into ITK?

Thanks for your help,
Kris

> From: Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>
> Date: 2011/3/11
> Subject: Re: [Insight-users] about  
> MersenneTwisterRandomVariateGenerator
> To: "Suyash P. Awate" <suyash at cs.utah.edu>
> Cc: insight-users at itk.org
>
>
>
> Le 12 mars 11 à 03:21, Suyash P. Awate a écrit :
>
>
>
> Hi all,
>
> The documentation in ITK-3.2 states that the  
> itkMersenneTwisterRandomVariateGenerator implementation isn't thread  
> safe.
>
> Now, if an application contains multiple threads that need to  
> simultaneously (and throughout the program's run time) generate  
> (independent) random-number sequences, what alternatives could be  
> used within ITK ?
>
> Thanks, in advance, for your suggestions,
> Suyash
>
> Hi,
>
> You can try with this modified version:
>
>  http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/itkThreadSafeMersenneTwisterRandomVariateGenerator.cxx
>  http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/itkThreadSafeMersenneTwisterRandomVariateGenerator.h
>
> Regards,
>
> Gaëtan
>
>
> -- 
> Gaëtan Lehmann
> Biologie du Développement et de la Reproduction
> INRA de Jouy-en-Josas (France)
> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
> http://voxel.jouy.inra.fr  http://www.itk.org
> http://www.mandriva.org  http://www.bepo.fr
>
>
> <PGP.sig>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110328/f24ff693/attachment.htm>


More information about the Insight-users mailing list