From ef624f92dee2cf905e2192dccb0d394bd04a778a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 23 Mar 2016 13:01:21 +0100 Subject: [PATCH] No need for a constructor just for default_random --- Random_numbers/include/CGAL/Random.h | 1 - Random_numbers/include/CGAL/Random_impl.h | 24 +++++------------------ Random_numbers/src/CGAL/Random.cpp | 2 +- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/Random_numbers/include/CGAL/Random.h b/Random_numbers/include/CGAL/Random.h index be938605263..20762d04bc2 100644 --- a/Random_numbers/include/CGAL/Random.h +++ b/Random_numbers/include/CGAL/Random.h @@ -66,7 +66,6 @@ public: // creation CGAL_EXPORT Random( ); CGAL_EXPORT Random( unsigned int seed); - CGAL_EXPORT Random(char*); // seed CGAL_EXPORT unsigned int get_seed ( ) const; diff --git a/Random_numbers/include/CGAL/Random_impl.h b/Random_numbers/include/CGAL/Random_impl.h index 17cbd503c94..fb097cca70e 100644 --- a/Random_numbers/include/CGAL/Random_impl.h +++ b/Random_numbers/include/CGAL/Random_impl.h @@ -46,7 +46,11 @@ Random( ) std::time_t s; std::time( &s); seed = (unsigned int)s; - +#if defined( CGAL_TEST_SUITE ) || defined( CGAL_PRINT_SEED ) + if(this == & get_default_random()){ + std::cerr << "default_random::get_seed() = " << seed << std::endl; + } +#endif // initialize random numbers generator rng.seed(static_cast(seed)); random_value = get_int(0, 1<<15); @@ -63,24 +67,6 @@ Random( unsigned int seed) } -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(seed)); - random_value = get_int(0, 1<<15); -} - // seed CGAL_INLINE_FUNCTION unsigned int diff --git a/Random_numbers/src/CGAL/Random.cpp b/Random_numbers/src/CGAL/Random.cpp index c88e1b7de65..40210d38557 100644 --- a/Random_numbers/src/CGAL/Random.cpp +++ b/Random_numbers/src/CGAL/Random.cpp @@ -29,7 +29,7 @@ namespace CGAL { - Random default_random = Random("default"); + Random default_random; } //namespace CGAL