enter code here
typedef thrust::tuple<float,float> vec2;
struct point_to_bucket_index : public thrust::unary_function<vec2,float>
{
__host__ __device__
vec2 operator()(const vec2& v) const
{
float x = static_cast<float>(thrust::get<0>(v) );
thrust::default_random_engine rng1;
thrust::random::normal_distribution<float> u01(x, 1.0f);
float x1 = u01(rng1);
float y = static_cast<float>(thrust::get<1>(v) );
// return the bucket's linear index
return vec2(x1,y);
}
};
I want to return different samples every time I call this struct. How do I do that? Is there any way to seed rng1? Can I use time to seed rng1?
Aucun commentaire:
Enregistrer un commentaire