id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 3971,basic_random_generator doesn't produce a fully randomized uuid when sizeof(unsigned long) == 4,gareth.sylvester-bradley@…,Andy Tompkins,"There is a flaw in basic_random_generator<> (boost/uuid/uuid_generators.hpp, line 366-374) that means it will only generate about 4 billion different values before a collision on the many platforms where sizeof(unsigned long) == 4. On these platforms the first 8 bytes of the uuid are populated with random data, but the contents of the remaining 8 bytes are undefined. In my tests they are populated with repeated data, due to Microsoft's specific implementation for the undefined behaviour of >> when its ""right operand is greater than or equal to the length in bits of the promoted left operand."" For example, try the following test program with a Win32 build by Visual C++ 9.0 – {{{ #include #include #include int main( int, char*[] ) { std::cout << boost::uuids::random_generator()() << std::endl; return 0; } }}} This produced for me: {{{ f1633d75-ee94-47b9-ae94-37b9ee9437b9 }}} Or wrapped to show the problem: {{{ f1633d75- ee94-47b9- ae94-37b9 ee94 37b9 }}} The simplest patch could be just: {{{ 370a370 > i=0; }}} ",Patches,closed,Boost 1.43.0,uuid,Boost 1.42.0,Showstopper,fixed,,