mirror of https://github.com/CGAL/cgal
Print the seed of CGAL::default_random in the testsuite or when CGAL_PRINT_SEED is defined
This commit is contained in:
parent
e4bfb46bcd
commit
a2e766f136
|
|
@ -66,6 +66,7 @@ public:
|
||||||
// creation
|
// creation
|
||||||
CGAL_EXPORT Random( );
|
CGAL_EXPORT Random( );
|
||||||
CGAL_EXPORT Random( unsigned int seed);
|
CGAL_EXPORT Random( unsigned int seed);
|
||||||
|
CGAL_EXPORT Random(char*);
|
||||||
|
|
||||||
// seed
|
// seed
|
||||||
CGAL_EXPORT unsigned int get_seed ( ) const;
|
CGAL_EXPORT unsigned int get_seed ( ) const;
|
||||||
|
|
@ -237,7 +238,8 @@ CGAL_EXPORT extern Random default_random;
|
||||||
#ifdef CGAL_HEADER_ONLY
|
#ifdef CGAL_HEADER_ONLY
|
||||||
inline Random& get_default_random()
|
inline Random& get_default_random()
|
||||||
{
|
{
|
||||||
static Random default_random;
|
static Random default_random("default");
|
||||||
|
std::cerr << "get_default_random()" << std::endl;
|
||||||
return default_random;
|
return default_random;
|
||||||
}
|
}
|
||||||
#else // CGAL_HEADER_ONLY
|
#else // CGAL_HEADER_ONLY
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,25 @@ Random( unsigned int seed)
|
||||||
random_value = get_int(0, 1<<15);
|
random_value = get_int(0, 1<<15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CGAL_INLINE_FUNCTION
|
||||||
|
Random::
|
||||||
|
Random(char* )
|
||||||
|
: val(0)
|
||||||
|
{
|
||||||
|
// get system's time
|
||||||
|
std::time_t s;
|
||||||
|
std::time( &s);
|
||||||
|
seed = (unsigned int)s;
|
||||||
|
|
||||||
|
#if defined( CGAL_TEST_SUITE ) || defined( CGAL_PRINT_SEED )
|
||||||
|
std::cerr << "default_random::get_seed() = " << seed << std::endl;
|
||||||
|
#endif
|
||||||
|
// initialize random numbers generator
|
||||||
|
rng.seed(static_cast<boost::int32_t>(seed));
|
||||||
|
random_value = get_int(0, 1<<15);
|
||||||
|
}
|
||||||
|
|
||||||
// seed
|
// seed
|
||||||
CGAL_INLINE_FUNCTION
|
CGAL_INLINE_FUNCTION
|
||||||
unsigned int
|
unsigned int
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
Random default_random;
|
Random default_random = Random("default");
|
||||||
|
|
||||||
} //namespace CGAL
|
} //namespace CGAL
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue