37 void Init() { SetDensity(.5f); }
41 float inv_density = 1.0f / density_;
42 float u = rand() * kRandFrac;
45 return u * inv_density;
50 void SetDensity(
float density)
52 density_ =
fclamp(density, 0.f, 1.f);
53 density_ = density_ * .3f;
58 static constexpr float kRandFrac = 1.f / (float)RAND_MAX;