[Insight-developers] vnl_sample issues
Brad King
brad.king at kitware.com
Fri Jan 21 11:55:37 EST 2005
Hello,
Karthik asked me to send an email summarizing the vnl_sample situation.
Basically vnl_sample is implemented either in terms of a hand-coded
implementation or a drand48 implementation if available. If it uses the
drand48 implementation then the user needs to call vnl_sample_reseed
(which calls srand48) to initialize the random number generator. The
only platform that seems to require this in practice is Cygwin, but it
is actually in the drand48 documentation. No matter the implementation
vnl_sample uses it still has a global state (per thread in the drand48
case).
I've discussed the situation with the VXL maintainers, but they already
implemented a solution. The latest vnl has a vnl_random class that is
an object-based random number generator. Each object has its own seed
and state information. This eliminates initialization and threading
issues altogether. There are two ways to get vnl_random into ITK:
1.) Try to pull over vnl_random.h and its related sources by hand.
2.) Upgrade ITK to the latest vxl (the current ITK vxl is over a year old).
#2 is not an option this close to a freeze. #1 will still require all
the ITK code that uses vnl_sample to be converted to use vnl_random,
which is also probably too big this close to a freeze.
I think the solution is to just do a
vnl_sample_reseed(0)
instead of a
vnl_sample_reseed(vcl_time(0))
to fix the problems on Cygwin for this release. Then we can use option
#2 after the release is done.
-Brad
More information about the Insight-developers
mailing list