mal-math
C++20 mathematics library.
All Classes Namespaces Files Functions Variables Typedefs Concepts
random.hpp File Reference

Provides functionality for random number generation and manipulation in vector spaces. More...

#include "../math.hpp"
#include <random>
Include dependency graph for random.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  mal_math
 Contains mathematical utility functions and classes.
 
namespace  mal_math::random
 
namespace  mal_math::random::_detail
 
namespace  mal_math::random::poisson_disc
 
namespace  mal_math::random::poisson_disc::_detail
 

Functions

template<AnyVec T>
vec< T::size, std::remove_const_t< typename T::type > > mal_math::random::_detail::UnitRandom (std::mt19937 &gen) noexcept
 Generates a unit vector with random direction.
 
template<AnyVec T, AnyVec U>
requires (T::size == U::size)
vec< T::size, std::remove_const_t< typename T::type > > mal_math::random::_detail::RandomVector (std::mt19937 &gen, U const &from, U const &to) noexcept
 Generates a random vector between two other vectors.
 
template<AnyVec T, Primitive U>
vec< T::size, std::remove_const_t< typename T::type > > mal_math::random::_detail::RandomVector (std::mt19937 &gen, U const &from, U const to) noexcept
 Generates a random vector where each value should be between from and to.
 
vec2 mal_math::random::RandomDirection2 (std::mt19937 &gen) noexcept
 Generates a random 2D float direction.
 
vec3 mal_math::random::RandomDirection3 (std::mt19937 &gen) noexcept
 Generates a random 3D float direction.
 
vec4 mal_math::random::RandomDirection4 (std::mt19937 &gen) noexcept
 Generates a random 4D float direction.
 
template<AnyVec U>
vec2 mal_math::random::RandomVector2 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
vec3 mal_math::random::RandomVector3 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
vec4 mal_math::random::RandomVector4 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
dvec2 mal_math::random::RandomDVector2 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
dvec3 mal_math::random::RandomDVector3 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
dvec4 mal_math::random::RandomDVector4 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
ivec2 mal_math::random::RandomIVector2 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
ivec3 mal_math::random::RandomIVector3 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
ivec4 mal_math::random::RandomIVector4 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
uivec2 mal_math::random::RandomUVector2 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
uivec3 mal_math::random::RandomUVector3 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
uivec4 mal_math::random::RandomUVector4 (std::mt19937 &gen, U const &from, U const &to) noexcept
 
template<AnyVec U>
std::vector< U > mal_math::random::poisson_disc::_detail::PoissonDisc (std::mt19937 &gen, U const &from, U const &to, float min_distance, size_t max_attempts=30) noexcept
 Generates a set of points distributed according to Poisson Disk Sampling.
 
std::vector< vec2mal_math::random::poisson_disc::Generate (std::mt19937 &gen, vec2 const &from, vec2 const &to, float min_distance, size_t max_attempts=30) noexcept
 Wrapper function for generating Poisson Disk sampled 2D points.
 

Detailed Description

Provides functionality for random number generation and manipulation in vector spaces.

This file contains utility functions for generating random vectors in 2D, 3D, and 4D spaces. It also provides Poisson Disk sampling for generating a random, yet evenly distributed set of points.

Definition in file random.hpp.