Random module
Random number generation, generation of points and directions, Monte Carlo utilities.
The Random module provides a random number generator suitable for ray tracing (via Wenzel Jakob's tiny pcg32 library), and several functions to generate points and directions useful in path tracing and procedural generation.
Global RNG and rejection sampling
- auto randf() -> float
- Global random number generator that produces floats between
[0,1)
- auto random_in_unit_sphere() -> Vec3f
- Sample a random point uniformly within a unit sphere (uses the global randf() RNG and rejection sampling)
- auto random_in_unit_disk() -> Vec2f
- Sample a random point uniformly within a unit disk (uses the global randf() RNG and rejection sampling)
- auto hash2d(int x, int y) -> uint32_t
- Hash two integer coordinates (e.g. pixel coordinates) into a pseudo-random unsigned int.
Function documentation
float randf()
#include <darts/sampling.h>
Global random number generator that produces floats between [0,1)
Vec3f random_in_unit_sphere()
#include <darts/sampling.h>
Sample a random point uniformly within a unit sphere (uses the global randf() RNG and rejection sampling)
Vec2f random_in_unit_disk()
#include <darts/sampling.h>
Sample a random point uniformly within a unit disk (uses the global randf() RNG and rejection sampling)
uint32_t hash2d(int x,
int y)
#include <darts/sampling.h>
Hash two integer coordinates (e.g. pixel coordinates) into a pseudo-random unsigned int.