Commit ebe99fd6 authored by Pietro Incardona's avatar Pietro Incardona
Browse files

Fixing color randomizer

parent b2256f8d
...@@ -305,8 +305,7 @@ class VTKWriter<vector,VECTOR_BOX> ...@@ -305,8 +305,7 @@ class VTKWriter<vector,VECTOR_BOX>
std::string get_cell_data_list() std::string get_cell_data_list()
{ {
// random engine // random engine
std::default_random_engine generator; SimpleRNG rng;
std::uniform_real_distribution<float> d(0.0,1.0);
//! vertex node output string //! vertex node output string
std::string v_out; std::string v_out;
...@@ -322,7 +321,7 @@ class VTKWriter<vector,VECTOR_BOX> ...@@ -322,7 +321,7 @@ class VTKWriter<vector,VECTOR_BOX>
while (it.isNext()) while (it.isNext())
{ {
// write a color // write a color
v_out += getColor(col_group,d,generator).toString() + " 1.0" + "\n"; v_out += getColor(col_group,rng).toString() + " 1.0" + "\n";
++it; ++it;
} }
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include "config.h" #include "config.h"
#include "util/SimpleRNG.hpp"
#ifndef UTIL_HPP_ #ifndef UTIL_HPP_
#define UTIL_HPP_ #define UTIL_HPP_
...@@ -65,11 +67,11 @@ struct RGB ...@@ -65,11 +67,11 @@ struct RGB
* *
*/ */
static inline struct RGB getColor(int group, std::uniform_real_distribution<float> & d, std::default_random_engine & g) static inline struct RGB getColor(int group, SimpleRNG & d)
{ {
struct RGB col; struct RGB col;
float s = d(g); float s = (float)d.GetUniform();
group = group % 12; group = group % 12;
......
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