CGVIS Utils
Loading...
Searching...
No Matches
Rand.h File Reference

Simple random number utility wrapping std::mt19937 with common ranges. More...

#include <random>
#include <algorithm>
Include dependency graph for Rand.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Random

Variables

Random staticRand
 Global PRNG instance for convenience functions.

Detailed Description

Simple random number utility wrapping std::mt19937 with common ranges.

Provides a small helper class, Random, for drawing floating-point values from frequently used ranges and for shuffling containers. The generator is an instance of std::mt19937 seeded either from std::random_device or an explicit seed. Distributions include [0,1), [-1,1), [0,\pi), [0,0.5), and [0.5,1).

Note
Thread-safety: Random is not inherently thread-safe. Guard access if you share a single instance across threads, or use thread-local instances.

Variable Documentation

◆ staticRand

Random staticRand
extern

Global PRNG instance for convenience functions.

Declared here and defined in a corresponding translation unit. Useful for quick sampling without managing an instance. Prefer explicit dependency injection for testability.