Skip to Content.
Sympa Menu

cgal-discuss - Influence of Delaunay triangulations on seeded random number generators

Subject: CGAL users discussion list

List archive

Influence of Delaunay triangulations on seeded random number generators


Chronological Thread 
  • From: Matthijs Sypkens Smit <>
  • To:
  • Subject: Influence of Delaunay triangulations on seeded random number generators
  • Date: Fri, 22 Dec 2006 14:22:11 +0100

Hi,

I came across the following: when I create a instance of a
Random_points_in_sphere_3 generator with a fixed random seed, then the
points are the same every time, except when I instantiate a Delaunay
triangulation before the creation of the points. Here is some code (I have
attached the complete code):
int main( )
{
Triangulation dt;

for (int i = 0; i < 5; i++) {
std::cout << *pgen << std::endl;
pgen++;
}

return 0;
}

This program produces points with different coordinates each time it is
run. When I uncomment the line 'Triangulation dt;', then the output is
always the same.

I suspect that one is supposed to be able to build a Delaunay triangulation
of random, but reproducible, numbers. Therefore I assume this might be a
bug. Can anyone confirm that the expected behaviour is that the randomly
generated points are identical on each run? Can the problem be reproduced?

I have not bothered to investigate the problem beyond isolating it. I
presume, assuming that this is a bug, that the Delaunay triangulation
makes some use of random numbers at initialisation, but this probably
should not affect anything outside the Triangulation object itself.


--
Matthijs Sypkens Smit
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>

#include <CGAL/point_generators_3.h>
#include <CGAL/Random.h>

#include <CGAL/Point_3.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;

typedef CGAL::Delaunay_triangulation_3<K>               Triangulation;

typedef CGAL::Point_3<K>                                    Point;

typedef CGAL::Creator_uniform_3<double,Point>                 Pt_creator;
typedef CGAL::Random_points_in_sphere_3<Point,Pt_creator>     Sphere_pgen;

CGAL::Random rnd( 2 );
Sphere_pgen pgen( 1.0, rnd );

int main( )
{
    Triangulation dt;

    for (int i = 0; i < 5; i++) {
        std::cout << *pgen << std::endl;
        pgen++;
    }
            
    return 0;
}




Archive powered by MHonArc 2.6.16.

Top of Page