Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Random class


Chronological Thread 
  • From: Julien Demouth <>
  • To:
  • Subject: Re: [cgal-discuss] Random class
  • Date: Wed, 23 Jul 2008 10:08:38 +0200

Bernd Gaertner a écrit :
Julien Demouth wrote:
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 ?

In which respect does it differ?

The implementation of Random class does not contain the type Random::State and member functions save_state and restore_state. Actually, it does not use internal states and does not respect the sentence "Different streams are independent of each other" [CGAL online doc, Ref. Manual of class Random, line 3 of Sec. Definition].

Is there any plan of designing a "better" Random class ?

If you mean the fact that you get the same sequence when you use the same seed, then I don't think it's bad. After all, it must be possible to reproduce the "random" data that for example lead to a failing run of an algorithm.

I agree, having the same sequence when you use the same seed is a good thing. The problem I wanted to emphasize is that Random instances are not independent. Thus, if you create a new Random instance (as it is the case when you create an instance of Triangulation_hierarchy_3), it reinitializes the internal state of _all_ your Random instances. To make it more concrete, I had an instance of Random to generate random points but each time I created a new Triangulation_hierarchy_3, the internal state used by my Random instance was modified. It took me some time to understand the problem.

Best,
Julien




Archive powered by MHonArc 2.6.16.

Top of Page