mirror of https://github.com/CGAL/cgal
Add random_shuffle to the high level functions
This commit is contained in:
parent
6e1b0d9e98
commit
0874e2604e
|
|
@ -25,6 +25,11 @@
|
|||
#include <CGAL/Hilbert_sort_2.h>
|
||||
#include <CGAL/Hilbert_sort_3.h>
|
||||
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
namespace internal {
|
||||
|
|
@ -33,6 +38,8 @@ namespace internal {
|
|||
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||
const Kernel &k, typename Kernel::Point_2 *)
|
||||
{
|
||||
boost::random_number_generator<boost::rand48> rng(boost::rand48(0L));
|
||||
std::random_shuffle(begin,end, rng);
|
||||
(Hilbert_sort_2<Kernel> (k)) (begin, end);
|
||||
}
|
||||
|
||||
|
|
@ -40,6 +47,8 @@ namespace internal {
|
|||
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||
const Kernel &k, typename Kernel::Point_3 *)
|
||||
{
|
||||
boost::random_number_generator<boost::rand48> rng(boost::rand48(0L));
|
||||
std::random_shuffle(begin,end, rng);
|
||||
(Hilbert_sort_3<Kernel> (k)) (begin, end);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@
|
|||
|
||||
#include <CGAL/Multiscale_sort.h>
|
||||
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
namespace internal {
|
||||
|
|
@ -36,6 +41,10 @@ namespace internal {
|
|||
const Kernel &k, typename Kernel::Point_2 *)
|
||||
{
|
||||
typedef Hilbert_sort_2<Kernel> Sort;
|
||||
|
||||
boost::random_number_generator<boost::rand48> rng(boost::rand48(0L));
|
||||
std::random_shuffle(begin,end,rng);
|
||||
|
||||
(Multiscale_sort<Sort> (Sort (k, 4), 16, 0.25)) (begin, end);
|
||||
}
|
||||
|
||||
|
|
@ -44,6 +53,10 @@ namespace internal {
|
|||
const Kernel &k, typename Kernel::Point_3 *)
|
||||
{
|
||||
typedef Hilbert_sort_3<Kernel> Sort;
|
||||
|
||||
boost::random_number_generator<boost::rand48> rng(boost::rand48(0L));
|
||||
std::random_shuffle(begin,end, rng);
|
||||
|
||||
(Multiscale_sort<Sort> (Sort (k, 8), 64, 0.125)) (begin, end);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue