Subject: CGAL users discussion list
List archive
- From: Doug Epps <>
- To:
- Subject: Re: [cgal-discuss] CGAL::Random
- Date: Tue, 21 Jun 2011 22:04:17 -0700
I believe (though i can't compile it right now) what Sylvain meant was to do:
CGAL::Random random;
for (int t = 1; t<4; t++)
{
double randi=random.get_double (0.0, 1);
std::cout << "randi" << randi << std::endl;
}
Note how the CGAL::Random is OUTSIDE the loop, and so is in scope for all 3
iterations of the loop, rather than being created for each one.
My intuition is that the creation of the CGAL::Random object seeds the
random-number generator.
So you're getting the same thing over and over.
On Jun 21, 2011, at 9:50 PM, sara Samadi wrote:
> for (int t=1; t<4; t++)
> > {
> > CGAL::Random random;
> > double randi=random.get_double (0.0, 1);
> > double mandi=random.get_double (0.0, 1);
> > std::cout<<"randi="<<randi<<std::endl;
> > std::cout<<"mandi="<<mandi<<std::endl;
> > }
- [cgal-discuss] CGAL::Random, sara123, 06/21/2011
- Re: [cgal-discuss] CGAL::Random, Sylvain Pion, 06/22/2011
- Re: [cgal-discuss] CGAL::Random, sara Samadi, 06/22/2011
- Re: [cgal-discuss] CGAL::Random, Doug Epps, 06/22/2011
- Re: [cgal-discuss] CGAL::Random, sara Samadi, 06/22/2011
- Re: [cgal-discuss] CGAL::Random, Guillaume Damiand, 06/22/2011
- Re: [cgal-discuss] CGAL::Random, Francois Berenger, 06/22/2011
- Re: [cgal-discuss] CGAL::Random, Laurent Rineau (GeometryFactory), 06/22/2011
- [cgal-discuss] Re: CGAL::Random, sara123, 06/28/2011
- Re: [cgal-discuss] CGAL::Random, sara Samadi, 06/22/2011
- Re: [cgal-discuss] CGAL::Random, Doug Epps, 06/22/2011
- Re: [cgal-discuss] CGAL::Random, sara Samadi, 06/22/2011
- Re: [cgal-discuss] CGAL::Random, Sylvain Pion, 06/22/2011
Archive powered by MHonArc 2.6.16.