Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Random class

Subject: CGAL users discussion list

List archive

[cgal-discuss] Random class


Chronological Thread 
  • From: Julien Demouth <>
  • To:
  • Subject: [cgal-discuss] Random class
  • Date: Tue, 22 Jul 2008 15:08:21 +0200

Hi all,

Maybe it is a question which has already been raised (I've seen no sign of this in the archive of the list) but why does the CGAL::Random documentation page differ from its implementation ?

Is there any plan of designing a "better" Random class ? Especially because the actual implementation may lead to weird behaviors, as with the following code:

for (int i = 0 ; i < 10 ; ++i)
{
CGAL::Triangulation_hierarchy_3 dt;
std::vector<...> pts;
CGAL::Random_points_on_sphere_3<...> gen;
CGAL::copy_n (gen, 64, std::back_inserter (pts));
dt.insert (pts.begin (), pts.end ());
...
}

Each loop produces the same set of points (and of course the same triangulation of these points). Indeed, the default constructor of Triangulation_hierarchy_3 creates a Random object which calls std::srand with a seed value of 0. It's a bit annoying and it may take some time to understand the problem :(

Best,
Julien





Archive powered by MHonArc 2.6.16.

Top of Page