Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] CGAL::Random

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] CGAL::Random


Chronological Thread 
  • From: "Laurent Rineau (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] CGAL::Random
  • Date: Wed, 22 Jun 2011 09:44:37 +0200
  • Organization: GeometryFactory

Le mercredi 22 juin 2011 09:17:44, sara Samadi a écrit :
> I havent test your idea yet, but i think it is not important for compiler
> that initialization is in or out of for loop because the compiler
> translate the statement (CGAL::Random random) only one time.

The compiler can optimize and do the memory allocation only once. *But* the
compiler must execute the content of the constructor of Random, and thus
reinitialize the variable, at every iteration of the loop. Have a look at the
constructor of Random, and you will understand why it differs!

--
Laurent Rineau, PhD
Release Manager of the CGAL Project http://www.cgal.org/
R&D Engineer at GeometryFactory http://www.geometryfactory.com/



Archive powered by MHonArc 2.6.16.

Top of Page