Commit 52333293 authored by Pietro Incardona's avatar Pietro Incardona

Fixing test with new random number generator

parent 29b76a5f
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "data_type/aggregate.hpp" #include "data_type/aggregate.hpp"
#include <random> #include <random>
#include "VTKWriter.hpp" #include "VTKWriter.hpp"
#include "util/SimpleRNG.hpp"
BOOST_AUTO_TEST_SUITE( vtk_writer_test ) BOOST_AUTO_TEST_SUITE( vtk_writer_test )
...@@ -771,9 +772,7 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set ) ...@@ -771,9 +772,7 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set )
// set the seed // set the seed
// create the random generator engine // create the random generator engine
std::srand(0); SimpleRNG rng;
std::default_random_engine eg;
std::uniform_real_distribution<float> ud(0.0f, 1.0f);
// fill the vector with random data // fill the vector with random data
v1ps.resize(100); v1ps.resize(100);
...@@ -786,32 +785,32 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set ) ...@@ -786,32 +785,32 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set )
for (size_t i = 0 ; i < v1ps.size(); i++) for (size_t i = 0 ; i < v1ps.size(); i++)
{ {
v1ps.template get<0>(i)[0] = ud(eg); v1ps.template get<0>(i)[0] = rng.GetUniform();
v1ps.template get<0>(i)[1] = ud(eg); v1ps.template get<0>(i)[1] = rng.GetUniform();
v1ps.template get<0>(i)[2] = ud(eg); v1ps.template get<0>(i)[2] = rng.GetUniform();
v2ps.template get<0>(i)[0] = ud(eg)*0.5; v2ps.template get<0>(i)[0] = rng.GetUniform()*0.5;
v2ps.template get<0>(i)[1] = ud(eg)*0.5; v2ps.template get<0>(i)[1] = rng.GetUniform()*0.5;
v2ps.template get<0>(i)[2] = ud(eg)*0.5; v2ps.template get<0>(i)[2] = rng.GetUniform()*0.5;
v3ps.template get<0>(i)[0] = ud(eg)*0.3; v3ps.template get<0>(i)[0] = rng.GetUniform()*0.3;
v3ps.template get<0>(i)[1] = ud(eg)*0.3; v3ps.template get<0>(i)[1] = rng.GetUniform()*0.3;
v3ps.template get<0>(i)[2] = ud(eg)*0.3; v3ps.template get<0>(i)[2] = rng.GetUniform()*0.3;
v1pp.template get<0>(i) = ud(eg); v1pp.template get<0>(i) = rng.GetUniform();
v1pp.template get<1>(i)[0] = ud(eg); v1pp.template get<1>(i)[0] = rng.GetUniform();
v1pp.template get<1>(i)[1] = ud(eg); v1pp.template get<1>(i)[1] = rng.GetUniform();
v1pp.template get<1>(i)[2] = ud(eg); v1pp.template get<1>(i)[2] = rng.GetUniform();
v2pp.template get<0>(i) = ud(eg); v2pp.template get<0>(i) = rng.GetUniform();
v2pp.template get<1>(i)[0] = ud(eg); v2pp.template get<1>(i)[0] = rng.GetUniform();
v2pp.template get<1>(i)[1] = ud(eg); v2pp.template get<1>(i)[1] = rng.GetUniform();
v2pp.template get<1>(i)[2] = ud(eg); v2pp.template get<1>(i)[2] = rng.GetUniform();
v3pp.template get<0>(i) = ud(eg); v3pp.template get<0>(i) = rng.GetUniform();
v3pp.template get<1>(i)[0] = ud(eg); v3pp.template get<1>(i)[0] = rng.GetUniform();
v3pp.template get<1>(i)[1] = ud(eg); v3pp.template get<1>(i)[1] = rng.GetUniform();
v3pp.template get<1>(i)[2] = ud(eg); v3pp.template get<1>(i)[2] = rng.GetUniform();
} }
// Create a writer and write // Create a writer and write
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment