On Apr 12, 2011, at 12:37 PM, JP wrote:
> I'd rather do it the Java way - something akin to using
> getCurrentTimeInMillis() as seed.
Which means that if you start N jobs on a multiprocessor machine, then
there's a decent chance you'll have several start in the same
millisecond.
If you're talking about bad luck, RDKit uses an RNG based on
minstd_rand, with a cycle of 2**31-2. By the birthday paradox, that's
about 55K runs before your first duplicate.
Greg:
> If you want truly random
> conformations, use something like randomSeed=random.randint(0,1e6)
Somehow a million doesn't seem as big as it used to be. That's only on
average 1,200 different runs before there's a duplicate.
Perhaps random.randrange(2**31) would be better. Or if it takes -2**31
to 2**31-1 as the possible seed range and you want to be hard-core
about it then:
>>> os.urandom(4)
';\xe9\x08\xfd'
>>> import struct
>>> struct.unpack("i", os.urandom(4))[0]
-1945482205
>>> struct.unpack("i", os.urandom(4))[0]
1656549131
> Yes, in utils.cpp, it always looks like it is initialized to static
> rng_type generator(42u);
I was curious about the choice of rng_type. utils.h says:
namespace RDKit{
...
typedef boost::uniform_int<> uniform_int;
where
typedef random::linear_congruential< int32_t, 48271, 0, 2147483647,
399268537 > minstd_rand;
I don't think minstd_rand is a good standard default, and I see that
other RDKit code agrees:
Fingerprints.cpp: typedef boost::mt19937 rng_type;
Code/SimDivPickers/MaxMinPicker.h: typedef boost::mt19937 rng_type;
Is it time to revisit the choice of minstd_rand for conformation
generation?
Andrew
[email protected]
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now! http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss