diff --git a/Packages/Random_numbers/doc_tex/Generator/Random.tex b/Packages/Random_numbers/doc_tex/Generator/Random.tex index d33d2fa9a2d..b9a6c55bed7 100644 --- a/Packages/Random_numbers/doc_tex/Generator/Random.tex +++ b/Packages/Random_numbers/doc_tex/Generator/Random.tex @@ -61,7 +61,6 @@ deterministically or using the seed functions as described below. values for \ccc{init} result in equal sequences of random numbers.} - % ----------------------------------------------------------------------------- \ccOperations @@ -70,12 +69,12 @@ deterministically or using the seed functions as described below. \ccMemberFunction{ int get_int( int lower, int upper);}{ returns a random \ccc{int} from the interval - $[$\ccc{lower}$,$\ccc{upper}$)$.} + $[\mbox{\ccc{lower},\ccc{upper}})$.} \ccMemberFunction{ double get_double( double lower = 0.0, double upper = 1.0);}{ returns a random \ccc{double} from the interval - $[$\ccc{lower}$,$\ccc{upper}$)$.} + $[\mbox{\ccc{lower},\ccc{upper}})$.} \ccMemberFunction{ int operator() ( int upper);}{ returns \ccVar\ccc{.get_int( 0, upper)}.} @@ -89,6 +88,13 @@ deterministically or using the seed functions as described below. \ccMemberFunction{ void restore_seed( Seed const& seed);}{ restores the internal seed from \ccc{seed}.} +% ----------------------------------------------------------------------------- +\ccHeading{Equality Test} + +\ccMemberFunction{ bool operator == ( CGAL_Random const& random2) const;}{ + returns \ccc{true}, iff \ccVar\ and \ccc{random2} have equal + internal seeds.} + % ----------------------------------------------------------------------------- \ccImplementation diff --git a/Packages/Random_numbers/doc_tex/support/Generator/Random.tex b/Packages/Random_numbers/doc_tex/support/Generator/Random.tex index d33d2fa9a2d..b9a6c55bed7 100644 --- a/Packages/Random_numbers/doc_tex/support/Generator/Random.tex +++ b/Packages/Random_numbers/doc_tex/support/Generator/Random.tex @@ -61,7 +61,6 @@ deterministically or using the seed functions as described below. values for \ccc{init} result in equal sequences of random numbers.} - % ----------------------------------------------------------------------------- \ccOperations @@ -70,12 +69,12 @@ deterministically or using the seed functions as described below. \ccMemberFunction{ int get_int( int lower, int upper);}{ returns a random \ccc{int} from the interval - $[$\ccc{lower}$,$\ccc{upper}$)$.} + $[\mbox{\ccc{lower},\ccc{upper}})$.} \ccMemberFunction{ double get_double( double lower = 0.0, double upper = 1.0);}{ returns a random \ccc{double} from the interval - $[$\ccc{lower}$,$\ccc{upper}$)$.} + $[\mbox{\ccc{lower},\ccc{upper}})$.} \ccMemberFunction{ int operator() ( int upper);}{ returns \ccVar\ccc{.get_int( 0, upper)}.} @@ -89,6 +88,13 @@ deterministically or using the seed functions as described below. \ccMemberFunction{ void restore_seed( Seed const& seed);}{ restores the internal seed from \ccc{seed}.} +% ----------------------------------------------------------------------------- +\ccHeading{Equality Test} + +\ccMemberFunction{ bool operator == ( CGAL_Random const& random2) const;}{ + returns \ccc{true}, iff \ccVar\ and \ccc{random2} have equal + internal seeds.} + % ----------------------------------------------------------------------------- \ccImplementation diff --git a/Packages/Random_numbers/web/Random.aw b/Packages/Random_numbers/web/Random.aw index 035b83e735b..c9f9161f00c 100644 --- a/Packages/Random_numbers/web/Random.aw +++ b/Packages/Random_numbers/web/Random.aw @@ -19,6 +19,7 @@ @article \setlength{\parskip}{1ex} +\addtolength{\textheight}{5ex} @! ============================================================================ @! Title @@ -127,8 +128,12 @@ section, so we do not comment on it here. int operator () ( int upper); + // seed functions void save_seed( Seed & seed) const; void restore_seed( Seed const& seed); + + // equality test + bool operator == ( CGAL_Random const& rnd) const; @end @@ -206,6 +211,8 @@ uniformly chosen from the interval $[\ccc{0.0},\ccc{1.0})$. The result is converted to a number in the given range. @macro = @begin + #include + inline bool CGAL_Random:: @@ -266,6 +273,24 @@ seed variable, respectively. } @end + +\subsection{Equality Test} + +The equality test compares the internal seeds of the two operands. + +@macro = @begin + inline + bool + CGAL_Random:: + operator == ( CGAL_Random const& rnd) const + { + return( CGAL_static_cast( bool, + ( _seed[ 0] == rnd._seed[ 0]) && + ( _seed[ 1] == rnd._seed[ 1]) && + ( _seed[ 2] == rnd._seed[ 2]) ) ); + } +@end + @! ============================================================================ @! Test @! ============================================================================ @@ -315,15 +340,17 @@ numbers. { CGAL_random.restore_seed( seed); // `CGAL_Random' and `rnd' CGAL_Random rnd( seed); // have the same seed now - assert( CGAL_random.get_bool() == rnd.get_bool()); + assert( CGAL_random.get_bool() == rnd.get_bool() ); assert( CGAL_random.get_int( -100,100) == rnd.get_int( -100,100)); - assert( CGAL_random.get_double() == rnd.get_double()); + assert( CGAL_random.get_double() == rnd.get_double() ); + assert( CGAL_random == rnd ); long init = CGAL_random( 9999); CGAL_Random rnd1( init), rnd2( init); - assert( rnd1.get_bool() == rnd2.get_bool()); + assert( rnd1.get_bool() == rnd2.get_bool() ); assert( rnd1.get_int( -100,100) == rnd2.get_int( -100,100)); - assert( rnd1.get_double() == rnd2.get_double()); + assert( rnd1.get_double() == rnd2.get_double() ); + assert( rnd1 == rnd2 ); } @end @@ -350,7 +377,6 @@ numbers. #ifndef CGAL_BASIC_H # include #endif - #include @ @@ -365,6 +391,8 @@ numbers. // operations @ + @ + #endif // CGAL_RANDOM_H @